Technical mailing list archives

Does store=True is enough for cache invalidation?

- 11/24/2015 16:08:02
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,