Odoo Write Another field on Compute Field change

Odoo Compute Field Trigger Write for Other field Change

Probuse Admin

Sample Code Python

Odoo Compute method call _write


Odoo CMS- Sample image floating  

   @api.multi
   def _write(self, vals):
       for rec in self:
           if 'is_paid' in vals:
               if vals['is_paid'] == True:
                   vals['state'] = 'paid'
       return  super(SalesCommission, self)._write(vals)


In above is_paid is compute field and when it changed its value it called _write so we can use _write to change our custom fields. (Please note that it its _write method not simple write).