In this blog we will explain how to create python function to return multi views in odoo for one model
For an example created custom tree view , custom form view and custom kanban view for the "res.partner" model with the bellow ids
tree view id = "res_partner_custom_tree_view"
form view id = "res_partner_custom_form_view"
kanban view id = "res_partner_custom_kanban_view"
and we created smart button on another model view which must call python function to open "res.partner" model with the previous views , so this function can be just like bellow
def display_partners(self):
tree_view_id = self.env.ref('module_name.res_partner_custom_tree_view')
form_view_id = self.env.ref('module_name.res_partner_custom_form_view')
kanban_view_id = self.env.ref('module_name.res_partner_custom_kanban_view')
return {
'type': 'ir.actions.act_window',
'name': "string",
'res_model': 'res.partner',
'domain': [('id', 'in',self.get_partner_ids().ids)],
'view_mode': 'tree,form',
'views':[(tree_view_id.id,'tree'),(form_view_id.id,'form'),(,(form_view_id.id,'form').id,'kanban')],
'target': 'current',
}
No comments:
Post a Comment