Compute Method In Odoo


Compute method  is used for making a field value as compute value . 

  • First you need to write the fuction for compute field in python file

eg: def  compute_total_estimate(self)   like this,

  •  Then you can create the corresponding xml file

Syntax as follows:

<Computed_value> = field.Char(compute=’<function name>’)

Here  <Computed_value>  filed value cannot be added by the user the value inside it can only be declared through the ‘<function name>’ function.

In Practical Case:

total_estimate=fields.Char(string=’Total Estimate ‘, compute=‘compute_total_estimate’)

Here compute=’compute_total_estimate’ is the function name.


To Know more About Us

Leave a Reply

Your email address will not be published.