Skip to Content
Menu
This question has been flagged
656 Zobrazenia

Is it possible to trigger calculation of a computed field created with Studio? I have a computed field (that is Stored) with the following code that works well for all records that are updated or new, but it does not calculate for the records that existed prior to creation of the computed field. I have tried to trigger a server action to compute the field, am not sure what the correct function to call is.


Basically what I would like is a button to click so that Odoo goes through and computes the initial value for the x_studio_kwh_volume for all sales order records.


self['x_studio_kwh_volume'] = 0
for record in self.order_line:
self['x_studio_kwh_volume'] += record.product_id.x_studio_kwh * record.product_uom_qty
Avatar
Zrušiť