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.
NOTE: This question is similar to this one, but its case is a different one with a completely different solution..
I have this situation:
field_1 has a compute method, which uses @api.depends('field_2', 'field_3').
But here comes the important part... the value given to field_1 depends on which field (field_2 or field_3) is modified by ORM (thus triggering the @api.depends).
Is there a way to know which field triggers a multi-triggered @api.depends?
I know I can capture that overriding write, but I would like to be reflected in view.
And I could use a onchange on field_2 and another on field_3, but then it would only be useful in views, no in ORM modifications.
You could have a common method and control based on field triggered
def main_method(self, field_triggered): # Control with field_triggered field value # .... pass @api.onchange('field1') def field1_trigger(self): self.main_method('field1') @api.onchange('field2') def field2_trigger(self): self.main_method('field2')
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 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: 6/3/15, 6:10 PM|
|Seen: 935 times|
|Last updated: 6/5/15, 1:30 AM|