From 41d91e2c96e40e26a95998766148ba22f6ca4431 Mon Sep 17 00:00:00 2001 From: amoyaux Date: Fri, 20 Oct 2017 11:21:18 +0200 Subject: [PATCH] [FIX] mrp: update MO qty with by_product fail Update MO qty compute the quantity already processed but it includes the by_product moves. This commit add a filter in order to only consider the move with the final product. --- addons/mrp/wizard/change_production_qty.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/wizard/change_production_qty.py b/addons/mrp/wizard/change_production_qty.py index 526a12d8ffc..bf447feee61 100644 --- a/addons/mrp/wizard/change_production_qty.py +++ b/addons/mrp/wizard/change_production_qty.py @@ -39,7 +39,7 @@ class ChangeProductionQty(models.TransientModel): def change_prod_qty(self): for wizard in self: production = wizard.mo_id - produced = sum(production.move_finished_ids.mapped('quantity_done')) + produced = sum(production.move_finished_ids.filtered(lambda m: m.product_id == production.product_id).mapped('quantity_done')) if wizard.product_qty < produced: raise UserError(_("You have already processed %d. Please input a quantity higher than %d ")%(produced, produced)) production.write({'product_qty': wizard.product_qty})