Odoo Development - Understanding Context
Understand how context is used, can be passed through actions, and then acted upon within a view
One of the primary mechanisms in Odoo Development is using a concept called 'context' to dynamically change views. The purpose of this video is to help Odoo developers better understand how context is used in Odoo and to provide some examples on how context can be passed through actions and then acted upon within a view.
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.
Diogo Duarte has a degree in Electrical Engineering and Computer Science with 20 years of experience in several industries, both functional and technical. He is an Odoo developer and Project Manager across the EU, the USA, and AU and the Head of Technical Consulting for OdooClass since 2014.
Diogo is an expert in all things Odoo and has been consulted on hundreds of Odoo projects in nearly every industry sector. If you need a problem solved with Odoo, Diogo can find you a solution.