Odoo 16 Studio Book - Conditional Properties

Conditional properties are used to make a field invisible, mandatory, or read-only under certain conditions by purpose. When we select a field or add a field using Studio, there is an options property as shown in the image below.

odoo-studio

There are three types of conditional properties - invisible, required, and read-only. We can choose invisible and visible fields according to our needs. We can also set the fields to mandatory and optional using the required option. There is also a read-only option to set fields to read-only.

After selecting the field, we can have three options in the property tab - invisible, required, and read-only. The field can easily be hidden by checking the appropriate invisible property. The use case is to hide the field, and this can be done using this property. The second is a required field. If the field is a required field and cannot be emptied, the required field is set to true. Then when saving the form, it doesn't populate with data. It shows an error message to protect the save without emptying the field. Another property is a read-only field. If true, the field cannot be edited.

To the right of these options is a 'Conditional' button. After clicking on it, we will see a domain widget for choosing the domain for the property. We can thus select the corresponding domain for each property. The domain can be entered as code in the code editor and also entered as filters based on conditions.

odoo-studio

After clicking the add filter button, we can select each field name corresponding to the values as shown in the image. It may have the option to filter the field according to our needs.

odoo-studio

Then we can select the corresponding filter and click the save button. It will filter matching this domain.

odoo-studio

In conclusion, Odoo Studio provides three types of conditional properties for customizing field behavior: invisible, required, and read-only. The Invisible property allows fields to be hidden or displayed based on specific needs. The required property determines whether the field is required or optional, which affects the form's data storage and displays error messages when necessary. Finally, the read-only property prevents the field from being modified if set to true. These features offer extensive control over field visibility, data integrity, and user interactions, allowing businesses to tailor the Odoo system to their exact requirements and improve overall usability.

whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message