From 07ab3543be734d78aef37cff6c7a970f37856760 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 25 Feb 2016 09:42:15 +0100 Subject: [PATCH] [FIX] sale_mrp, purchase: delivered quantity The quantity delivered must be converted in the product UoM of the BoM line. Indeed, the UoM of the BoM line can be different from the UoM of the product which is manufactured. opw-669764 --- addons/purchase/purchase.py | 2 +- addons/sale_mrp/sale_mrp.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 709ce9b437f..be5a5edecda 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -488,7 +488,7 @@ class PurchaseOrderLine(models.Model): qty = 0.0 for move in line.move_ids: if move.state == 'done' and move.product_id.id == bom_line.get('product_id', False): - qty += self.env['product.uom']._compute_qty_obj(move.product_uom, move.product_uom_qty, self.product_uom) + qty += self.env['product.uom']._compute_qty(move.product_uom.id, move.product_uom_qty, bom_line['product_uom']) if float_compare(qty, bom_line['product_qty'], precision_digits=precision) < 0: bom_delivered[bom.id] = False break diff --git a/addons/sale_mrp/sale_mrp.py b/addons/sale_mrp/sale_mrp.py index 48b22f53210..35bb2c539a8 100644 --- a/addons/sale_mrp/sale_mrp.py +++ b/addons/sale_mrp/sale_mrp.py @@ -48,7 +48,7 @@ class SaleOrderLine(models.Model): qty = 0.0 for move in self.procurement_ids.mapped('move_ids'): if move.state == 'done' and move.product_id.id == bom_line.get('product_id', False): - qty += self.env['product.uom']._compute_qty_obj(move.product_uom, move.product_uom_qty, self.product_uom) + qty += self.env['product.uom']._compute_qty(move.product_uom.id, move.product_uom_qty, bom_line['product_uom']) if float_compare(qty, bom_line['product_qty'], precision_digits=precision) < 0: bom_delivered[bom.id] = False break