Community: Framework mailing list archives

Re: Does store=True is enough for cache invalidation?

Bogdan Lisnenko
- 11/28/2015 06:29:50
debit, credit , balance are also computed fields. Maybe you can't depend on computed fields which are non stored.
Try to extend _compute_debit_credit_balance function.

2015-11-26 2:06 GMT+02:00 Manuel Vázquez <>:
Using the new API we're extending the account_analytic_account model to
evaluate store some performance indicators:

class AnalyticAccount(Model):

    _inherit = _name = 'account.analytic.account'

    perf_indicator = fields.Float('Perfomance indicator', compute='_compute_perf', store=True)

    @api.depends('debit', 'balance')

    def _compute_perf(self):

	for record in self:
            # Our indicator is not just this, but to get an idea.
            record.perf_indicator = record.balance/record.debit if record.debit !=0 else 0

Nevertheless after adding more costs to an analytic account the balance
is updated but the performance index is not recalculated.

Do I still need to put store as a dictionary in these case?  How does
stored fields interact with non-stored one?  Can I have an stored field
that depends upon a non-stored one?  Does that imply that my stored
field will always be computed anyways?  Are the semantics in this case

Best regards,

Post to: