Odoo 18 Studio Book : Define Compute Method

In Odoo, fields can be calculated in two main ways: either based on the values of other fields or independently. In this guide, we'll explore how to define a computed field using the Studio module.

As an example, let’s create a computed field that calculates the total quantity of products in a Sale Order.

To begin, we first need to add a new field for the total quantity in the Sale Order model.

odoo 19

To configure a compute method for the field, open the Studio editor, select the field, and navigate to the "More" option.

odoo 19

In the configuration view, you can add the fields it depends on and provide the Python code to compute its value.

odoo 19

We are setting it up as illustrated in the image below.

odoo 19

In the end, the field will display the total quantity of products.

odoo 19
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