From 6f8f0d4bc38953c0601ef776416c5cede15c44b8 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 22 Jun 2020 14:55:46 +0000 Subject: [PATCH] [FIX] mrp: multiple BOM - Create 3 products A, B1, B2 - Create a BOM for A: Manufacture, 1 unit of B1 - Create another BOM or A: Kit, 1 unit of B2 - Create a MO for A - Click on 'Produce' B2 appears as a 'By-product'. Upon saving, an error occurs because of a rounding set to zero. The issues is coming from the generation of the `move_finished_ids`. Since the product A has a BOM kit, the latter is exploded and added as 'By-product'. We should not try to find phantom BOM for this specific use case. A solution is to not explote the move produced. opw-2251423 closes odoo/odoo#53526 X-original-commit: 226ccc2f64d00a19e0ae8851c45051106aa49adc Signed-off-by: Nicolas Martinelli (nim) --- addons/mrp/models/stock_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py index a3fc758cdfc..3ad3ba69067 100644 --- a/addons/mrp/models/stock_move.py +++ b/addons/mrp/models/stock_move.py @@ -227,7 +227,7 @@ class StockMove(models.Model): moves_to_unlink = self.env['stock.move'] phantom_moves_vals_list = [] for move in self: - if not move.picking_type_id: + if not move.picking_type_id or (move.production_id and move.production_id.product_id == move.product_id): moves_to_return |= move continue bom = self.env['mrp.bom'].sudo()._bom_find(product=move.product_id, company_id=move.company_id.id, bom_type='phantom')