openerp - Odoo 10: Open a form view in an editable tree view -
i creating new model in odoo 10. model accessed through menu item launches tree view.
tree view editable able launch form view specific record user editing if user wants to.
is there option either put button in tree view launch form view or something? highlight steps required or point similar code example?
thanks,
using buttons : in tree view:
<tree editable="top"> ... ... <button name="open_record" type="object" class="oe_highlight"/> </tree>
in model:
@api.multi def open_record(self): # first need id of record # didn't specify want edit rec_id = self.somemany2onefield.id # if have more 1 form view specify form id form_id = self.env.ref('module_name.form_xml_id') # open form return { 'type': 'ir.actions.act_window', 'name': 'title', 'res_model': 'your.model', 'res_id': rec_id.id, 'view_type': 'form', 'view_mode': 'form', 'view_id': form_id.id, 'context': {}, # if want open form in edit mode direclty 'flags': {'initial_mode': 'edit'}, 'target': 'current', }
Comments
Post a Comment