Hii.
I have a One2Many relation in a header table. My child table has a status field. I want when the status of all child lines is done, then the status of header status field should turn to done automatically. How it could be achieved?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hii.
I have a One2Many relation in a header table. My child table has a status field. I want when the status of all child lines is done, then the status of header status field should turn to done automatically. How it could be achieved?
Hello Muhammad Anees
You can add header status field computed type and computed function like below
@ api.depends ('child_ids.state')
def _compute_count (self):
for parent in self:
doneIds = parent.child_ids.filtered (lambda child: child.state == 'done'). ids
if len (doneIds) == len (parent.child_ids):
parent.state = "done"
Regards
Anisha Bahukhandi
Technical Content Writer
Webkul
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up