odoo icon indicating copy to clipboard operation
odoo copied to clipboard

[FIX] mrp_production: Fix always replanning workorders

Open qung-odoo opened this issue 1 year ago • 3 comments

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

qung-odoo avatar Aug 15 '24 21:08 qung-odoo

Pull request status dashboard

robodoo avatar Aug 15 '24 21:08 robodoo

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 avatar Aug 29 '24 16:08 qung-odoo

@qung-odoo could you add a test that protect this flow ? thank you

Whenrow avatar Aug 30 '24 07:08 Whenrow

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.

qung-odoo avatar Sep 03 '24 20:09 qung-odoo