Odoo Help

0

How to use the triggers for compute field in odoo?

By
Tangaraj
on 11/3/15, 1:06 AM 1,018 views

Hi

I need a trigger value,

cost_store_triggers = {'product.product':(_get_replace_cost, ['cost'], 5)}

In that case I need a recomputed value for all related (parent and child product cost) product cost so I used this trigger, but it's not working.

Cost = fields. Float (string='Cost', compute=_get_replace_cost, store=cost_store_triggers)

0
Baiju KS
On 11/3/15, 1:53 AM

Hi,

you can use @api.depends() for this : specify the field dependencies; those dependencies are used to determine when to recompute the field; recomputation is automatic and guarantees cache/database consistency. Note that the same method can be used for several fields, you simply have to assign all the given fields in the method; the method will be invoked once for all those fields.

 @api.depends('field1', 'field2')

Hope this helps.



About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)

Stats

Asked: 11/3/15, 1:06 AM
Seen: 1018 times
Last updated: 11/3/15, 2:07 AM