From ade80e0f8c2a6451c5ca5b55bb9e85cecac82a1b Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 6 Jan 2020 10:02:49 +0000 Subject: [PATCH] [FIX] sale_mrp: use `previous_product_uom_qty` Since revision cb618e9a99ea3b86fdeed0, `previous_product_uom_qty` is not set in the context anymore but passed as parameter. opw-2146706 closes odoo/odoo#42820 X-original-commit: 33741910e32680e644e2509d108b0cd4a4138013 Related: odoo/enterprise#7565 Signed-off-by: Nicolas Martinelli (nim) --- addons/sale_mrp/models/sale_mrp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_mrp/models/sale_mrp.py b/addons/sale_mrp/models/sale_mrp.py index 8bba330ca30..3fa0d216235 100644 --- a/addons/sale_mrp/models/sale_mrp.py +++ b/addons/sale_mrp/models/sale_mrp.py @@ -68,6 +68,6 @@ class SaleOrderLine(models.Model): # and after update, and return the difference. We don't take into account what was already # sent, or any other exceptional case. bom = self.env['mrp.bom']._bom_find(product=self.product_id, bom_type='phantom') - if bom and 'previous_product_uom_qty' in self.env.context: + if bom and previous_product_uom_qty: return previous_product_uom_qty and previous_product_uom_qty.get(self.id, 0.0) return super(SaleOrderLine, self)._get_qty_procurement(previous_product_uom_qty=previous_product_uom_qty)