From d57fce203543ec0bd00478a35576bccd05a8b3b7 Mon Sep 17 00:00:00 2001 From: William Henrotin Date: Mon, 22 Jun 2020 08:15:41 +0000 Subject: [PATCH] [FIX] mrp: create backorder with no components Consuming all the components for only a part of the finished product will ask the manufacturing user to create a backorder. Confirm it will fail as there are no component left to consume to produce the remaining quantity of finished product. This commit only confirm backorders that still have some quantities to consume. Task : 2278147 X-original-commit: 51c9281d715e27143955c7b9b51f60b22e672f52 --- addons/mrp/models/mrp_production.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index 07537456a6f..294cb96d2d4 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -1376,7 +1376,8 @@ class MrpProduction(models.Model): workorder.duration_expected = workorder.duration_expected * ratio for workorder in backorder_mo.workorder_ids: workorder.duration_expected = workorder.duration_expected * (1 - ratio) - backorders.action_confirm() + # Confirm only productions with remaining components + backorders.filtered(lambda mo: mo.move_raw_ids).action_confirm() # Remove the serial move line without reserved quantity. Post inventory will assigned all the non done moves # So those move lines are duplicated.