How To Set Store Trigger For Computed Fields In Odoo 8?
I started using the new API of Odoo v8.0 but I cannot find useful information about store trigger in computed fields like this (for v7.0 and v6.1): Store Parameter in Odoo v6 In Od
Solution 1:
In V8, you can use any fields as computed fields. In V8 store is a parameter which is a boolean and by default it is false.
If you set explicitly "store=True", the dependent field you mentioned in @api.depends('name'), will acts as a triggering field.
You can specify, the other object field as a triggering field which will be must in accounting module like @api.depends('other_object.field_name')
upper = fields.Char(compute='_compute_upper', store=True)
@api.depends('name')def_compute_upper(self):
for rec in self:
self.upper = self.name.upper() if self.name elseFalse
If it "false", then the value is not stored in database and will be computed everytime.
upper = fields.Char(compute='_compute_upper')
Post a Comment for "How To Set Store Trigger For Computed Fields In Odoo 8?"