summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Grazioso (agr-odoo) <agr@odoo.com>2020-11-10 15:48:08 +0000
committerAndrea Grazioso (agr-odoo) <agr@odoo.com>2020-11-17 08:00:36 +0000
commita32bdf257d7a960fcd96cf6d32443bfe0295a296 (patch)
tree5ed0046d21c1d4259737ab441ecd89a7e7fe7002
parent7ddd5c0e9a2178ea8875d7ef59c3e3ade46b5506 (diff)
[FIX] mrp: double consuming in backorder operations
- Create product FP product to manufacture - Create BoM: - 10 units of FP - Product CP (component) - two operations. - Create MO for FP and plan. - Complete operation 1 for the 10 units - Complete operation 2 for 4 units only - Mark MO as done for 4 units - Click Create Backorder - Check backorder MO Operation 1 is present, marked todo for 6 units, but it was completed for all 10 units. With this commit the quantity todo for the corresponding operation in the backorder is updated to match the qty already produced Removing `qty_producing` as it is computed according to https://github.com/odoo/odoo/blob/ff648a0ace9cf72274211662707e7ee33fc73252/addons/mrp/models/mrp_workorder.py#L50 opw-2374640 closes odoo/odoo#61603 Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
-rw-r--r--addons/mrp/models/mrp_production.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py
index a7952b1a207..2b98d6d0043 100644
--- a/addons/mrp/models/mrp_production.py
+++ b/addons/mrp/models/mrp_production.py
@@ -1414,8 +1414,8 @@ class MrpProduction(models.Model):
new_moves_vals.append(move_vals[0])
new_moves = self.env['stock.move'].create(new_moves_vals)
backorders |= backorder_mo
- for wo in backorder_mo.workorder_ids:
- wo.qty_produced = 0
+ for old_wo, wo in zip(production.workorder_ids, backorder_mo.workorder_ids):
+ wo.qty_produced = max(old_wo.qty_produced - old_wo.qty_producing, 0)
if wo.product_tracking == 'serial':
wo.qty_producing = 1
else: