Browse Source

[FIX] cpo: use uom_po_id.factor to compute expected coverage

pull/145/head
robin.keunen 6 years ago
parent
commit
2634067c7b
  1. 4
      compute_purchase_order/models/computed_purchase_order_line.py

4
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)
)
Loading…
Cancel
Save