Sunday, December 6, 2020

open specific view from many2one field

 ODOO 



In this case we have many2one field for model that has more than one view and we want to open specific view from this field for this model

let us give an example :

- we have model "object.a" and model "object.b", in which we have object_a_id field as bellow 

object_a_id = fields.Many2one('object.a', string="Object A")

 

- model "object.a" has two form view with ids "object_a_form_view_1" and "object_a_form_view_2" and "object_a_form_view_1" id the default view and we want to show the other view from object_a_id field , so we can do it by add the field in the xml file as bellow

 

<field name="object_a_id" context="{'form_view_ref':'module_name.object_a_form_view_2',}" />

No comments:

Post a Comment

Odoo Invoice Qr code issues

There are two main issues must of us facing with the QR code in Odoo invoice & these issues are 1/ QR code displayed as broken image w...