[FIX] mrp: wrong consumption after merge

1) Create + Confirm two MO's for product
2) Merge Confirmed MO's together
3) Mark MO as Done
4) Press Apply on Immediate Production
4a) Stops consumption due to no Components being declared
4b) Would expect the Consumption Warning Wizard to be triggered here to allow use of "Validate & Set Quantities" button

It happens due to #85301 the purpose was to avoid the rules from
stock.move. However for other functionalities of MO like manual
consumption. We would like to keep the standard behavior.

Call the classic action_confirm but after manualy updated the stock.move

opw-3577267

closes odoo/odoo#144350

X-original-commit: dcf13fd1127436abb3c6a5f225f8f99d571330a3
Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
This commit is contained in:
Arnold Moyaux
2023-11-30 19:55:13 +00:00
parent 0ca72f89b6
commit eedb56c18f
+1 -2
View File
@@ -2283,8 +2283,7 @@ class MrpProduction(models.Model):
if 'confirmed' in self.mapped('state'):
production.move_raw_ids._adjust_procure_method()
(production.move_raw_ids | production.move_finished_ids).write({'state': 'confirmed'})
production.workorder_ids._action_confirm()
production.state = 'confirmed'
production.action_confirm()
self.with_context(skip_activity=True)._action_cancel()
# set the new deadline of origin moves (stock to pre prod)