From 4658f8f0aff231b7ca9429f4fe0017a061a5cd5a Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 19 Jun 2020 14:39:54 +0000 Subject: [PATCH] [FIX] mrp: unbuild with lot - Create 3 products: A: kg, no tracking B: kg, tracked by lot AB: kg, no tracking - Create a BOM for AB: 1 kg of A 30 g of B - Create a MO for 1 kg of AB, validate and close the MO - Unbuild the MO A stock move for 0.03 g of B is created instead of 30 g. This happens because we wrongly compare the quantity in the UoM of the stock move with a normalied quantity. opw-2278727 closes odoo/odoo#53390 X-original-commit: 6790e89f97d6bbbaab4e071af52cce9ccee98821 Signed-off-by: Nicolas Martinelli (nim) --- addons/mrp/models/mrp_unbuild.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/models/mrp_unbuild.py b/addons/mrp/models/mrp_unbuild.py index 6d345e75763..03eb22dbf00 100644 --- a/addons/mrp/models/mrp_unbuild.py +++ b/addons/mrp/models/mrp_unbuild.py @@ -181,7 +181,7 @@ class MrpUnbuild(models.Model): if move.has_tracking != 'none': original_move = move in produce_moves and self.mo_id.move_raw_ids or self.mo_id.move_finished_ids original_move = original_move.filtered(lambda m: m.product_id == move.product_id) - needed_quantity = move.product_qty + needed_quantity = move.product_uom_qty moves_lines = original_move.mapped('move_line_ids') if move in produce_moves and self.lot_id: moves_lines = moves_lines.filtered(lambda ml: self.lot_id in ml.produce_line_ids.lot_id) # FIXME sle: double check with arm