[FIX] mrp_production: Fix always replanning workorders
This fix addresses an issue where a replanning of workorders is always done on any changes to the production order.
Error:
The conditional statement if workorder_ids in self will always be True and we will always replan the workorders on every changes to the production order.
This fix changes the condition to check if 'workorder_ids' in vals ensuring that we are only replanning when there is a change to the workorders.
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Hello @Whenrow :wave:
Could you please take a look at this when you have time? This one might have been a typo that slipped through. Thank you! :pray:
@qung-odoo could you add a test that protect this flow ? thank you
Hello @Whenrow ,
Thank you for taking a look. After a thorough look at this case, it seems that we are already checking for workorder_ids in vals in the couple lines below:
if any(field in ['move_raw_ids', 'move_finished_ids', 'workorder_ids'] for field in vals) and production.state != 'draft':
Therefore, I'm changing this to a [REM] commit as
if 'workorder_ids' in self
The check always returns True and is not needed.
This shouldn't affect the current functionality of replanning the work orders.
