Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I need to have a field A that is recomputed when a field B is changed.
But also need that field B is recomputed when field A changes.
I tried using two @api.depends methods, dealing myself to avoid actual infinite changes. But Odoo just throws a recursion error making this way impossible.
In version 6.1 and 7.0 I used some ugly hacks like onchange methods and dummy boolean fields, or trying to use the context to set a flag to cut the changes (still fighting with it). And that's what I am trying now in v8, with @api.onchange, but that is an ugly hack anyway.
Another cleaner way to deal with this situation, please?
Also see my question about the usage/update of context: https://www.odoo.com/forum/help-1/question/how-to-actually-use-and-modify-context-71903
So far, in this situation (A may modify B, B may modify A):
- @api.depends: impossible. Simply raises errors and Odoo server crashes.
- @api.onchange + context: no way if I cannot update context.
- @api.onchange + readonly boolean fields: It looks the only way, like in v6.1. But it is ugly, weird, hard to implement and completely sends to hell the promised new API "easiness".
There must be an easier way with API v8, isn't it? Sure I am just missing it... I hope.
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
|Asked: 12/30/14, 6:16 PM|
|Seen: 1993 times|
|Last updated: 3/16/15, 8:10 AM|