Odoo Help

Welcome!

This community 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.

0

How to use the triggers for compute field in odoo?

By
Bailey
on 11/3/15, 1:06 AM 458 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

Akhil P Sivan

--Akhil P Sivan--
3423
| 5 3 6
Kochi, India
--Akhil P Sivan--

Interested in exploring Odoo both technically & functionality wise.

email-id : akhilpsivan01@gmail.com

Akhil P Sivan
On 11/3/15, 2:07 AM
0

Baiju

--Baiju--
3154
| 5 4 8
Kochi, India
--Baiju--
ODOO technical and functional

        I like learning new thing, especially technical thing. I am a quick learner, I can learn technical things very fast. I have good logical skill,  I have immense interest in programming.

e-mail id : baijuks@hotmail.com

Baiju
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.



Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

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