Community: Framework mailing list archives

expert-framework@mail.odoo.com

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

by
tran anh dung
- 12/02/2015 00:07:32
You should use:
perf_indicator = fields.Float('Perfomance indicator', compute='_compute_perf', store=False)
Best regards,
Tran.

2015-11-28 18:34 GMT+07:00 Bogdan Lisnenko <lem8r.ka11a@gmail.com>:
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 <manuel@merchise.org>:
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
undefined?

Best regards,
Manuel.

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--

Trần Anh Dũng (.Mr)
Phone: 0989 345 654