How-To (tech) Dynamically Modify Your View!

This a tech tutorial on how to dynamically modify your view on Odoo. In Odoo, once a view record is defined, there is not much possibility of dynamically changing it according to the record(s) that it is showcasing. For example, in its XML definition, you can’t make the ‘string‘ attribute of a field to be the value of another field.

Most of the time, our needs can be solved using selection fields, notably state/type, if the changes we would like to impose are limited to a few variations. But it does not resolve the need to dynamically change the view according to model contents.

It is therefore needed that we override the fields_view_get function in the models.Model. Since apparently its documentation is “scarce”¬†on line, we shall take a detailed tour around it.
Continue reading