From 2634067c7bb41b6d53003244d3f9b8b5dc6de36a Mon Sep 17 00:00:00 2001 From: "robin.keunen" Date: Wed, 3 Apr 2019 16:26:06 +0200 Subject: [PATCH] [FIX] cpo: use uom_po_id.factor to compute expected coverage --- compute_purchase_order/models/computed_purchase_order_line.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compute_purchase_order/models/computed_purchase_order_line.py b/compute_purchase_order/models/computed_purchase_order_line.py index 92ca505..3e82b65 100644 --- a/compute_purchase_order/models/computed_purchase_order_line.py +++ b/compute_purchase_order/models/computed_purchase_order_line.py @@ -126,7 +126,8 @@ class ComputedPurchaseOrderLine(models.Model): cpol.subtotal = cpol.product_price * cpol.purchase_quantity avg = cpol.average_consumption if avg > 0: - qty = cpol.virtual_available + cpol.purchase_quantity + qty = ((cpol.virtual_available / cpol.uom_id.factor) + + (cpol.purchase_quantity / cpol.uom_po_id.factor)) cpol.virtual_coverage = qty / avg else: # todo what would be a good default value? (not float(inf)) @@ -193,4 +194,3 @@ class ComputedPurchaseOrderLine(models.Model): u'%s:%s template has no variant set' % (self.product_template_id.id, self.product_template_id.name) ) -