[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#61841

X-original-commit: a32bdf257d7a960fcd96cf6d32443bfe0295a296
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2020-11-17 11:31:36 +00:00
parent 64d9120ed2
commit d50a840c21
+2 -2
View File
@@ -1389,8 +1389,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: