Passing parameters to forms and actions – context
Internally, every method in Odoo has access to a dictionary called context, which is propagated from every action to the methods involved in delivering that action. The UI also has access to it, and it can be modified in various ways by setting values in the context. In this recipe, we’ll explore some of the applications of this mechanism by toying with the language, default values, and implicit filters.
Getting ready
While not strictly necessary, this recipe will be more fun if you install the French language if you haven’t got this already. Consult Chapter 11, Internationalization, for how to do this. If you have a French database, change fr_FR
to some other language, e.g., en_US
will do for English. Additionally, click on the Active button (changing to Archive when you hover over it) for one of the hostel rooms in order to archive it and verify that this partner doesn’t show up in the list anymore...