I was testing the modules of Odoo 15 that I developed in Odoo 16, I was using a lot of the method fields_views_get
to have some behaviors to inject domain and context, before to render the component, but currently I can not find this method.
Someone here knows what will be the alternative to achieve some behavior in runtime (modify the XML with the etree
component of lxml
)?
The main goal here is to inject in the XML data that is very difficult to add without the env
object since with the fields_views_get
I was able to inject or make queries before returning the XML.
fields_view_get
was renamed to get_view
:
fields_view_get
becomesget_view
. As it no longer returns the fields description, keeping thefields
in the namefields_view_get
no longer makes sense. Hence removingfields
from the method name, it becomesview_get
. As it gets renamed anyway, we take the opportunity to rename itget_view
, which is more in line with the general getter/setter guidelines in the model object world.
-_fields_view_get
becomes_get_view
. For the same reasons than above.
-load_views
becomesget_views
.
You can find more details in refactor fields_view_get, load_views commit
In the changed files, you can see an example of commit diff of res_users model which replaces:
def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
With:
def get_view(self, view_id=None, view_type='form', **options):