Using context in Odoo - Super charge your Odoo Development
Much like any programming language or framework, Odoo has a learning curve that Odoo developers will have to climb to become skilled at creating Odoo applications. In the beginning most of the learning involves understanding models, modifying fields, and the basics of creating views and displaying data within Odoo. The next step, for more intermediate developers is understanding how context is used to make your views dynamic. That is the ability to alter what is displayed on your forms and tree views based on user selections.
Odoo Context for dynamic forms and views in Odoo
In this video Diogo begins by showing you how to use grep, a powerful command line tool used in Ubuntu/Linux, to find examples of context. Like much of Odoo development, some of the best ways to learn how to create your own custom applications is examining the Odoo source code. From there the video shows you how to use debug mode to examine actions and learn the basics for passing context from actions into Odoo views and forms.
See how to dynamically show and hide columns in views
There is a great deal of power in using context within Odoo. While we often think of filters in Odoo for filtering record results, context also allows you to use search filters to dynamically hide and show columns. While the concept is simple, there are countless applications and it is a fundamental building block for creating custom Odoo solutions. Now instead of just a single static set of columns, you can create views that contain different result sets based on user selections. This effectively gives you the power to make user friendly forms that contain exactly the information needed for a given business requirement.