From 004e7f3256cd8b659aca84620b3ace29624ba7d8 Mon Sep 17 00:00:00 2001 From: William Henrotin Date: Fri, 24 Jul 2020 09:40:27 +0000 Subject: [PATCH] [FIX] mrp: do not split additional product On a production, additional are supposed to be linked to the current lot/serial number and not to the total production like the raw component on the BoM. This commit do not split stock move for those product anymore at the backorder creation. Task : 2278147 --- addons/mrp/models/mrp_production.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index e7a24fa6805..04ae38d6700 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -1395,13 +1395,15 @@ class MrpProduction(models.Model): }) else: for move in production.move_raw_ids | production.move_finished_ids: - new_move = self.env['stock.move'].browse(move._split(move.product_uom_qty - move.unit_factor * production.qty_producing)) - if move.raw_material_production_id: - new_move.raw_material_production_id = backorder_mo.id - else: - new_move.production_id = backorder_mo.id - (move | new_move)._do_unreserve() - (move | new_move)._action_assign() + if not move.additional: + qty_to_split = move.product_uom_qty - move.unit_factor * production.qty_producing + new_move = self.env['stock.move'].browse(move._split(qty_to_split)) + if move.raw_material_production_id: + new_move.raw_material_production_id = backorder_mo.id + else: + new_move.production_id = backorder_mo.id + (move | new_move)._do_unreserve() + (move | new_move)._action_assign() backorders |= backorder_mo for wo in backorder_mo.workorder_ids: wo.qty_produced = 0