summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Masereel <pim@odoo.com>2017-01-17 16:18:16 +0100
committerPierre Masereel <pim@odoo.com>2017-01-18 11:45:26 +0100
commit1f6ec2b8d65279ca6a5259ee91d098dc4d1a71f2 (patch)
tree22953a430ca85923d75b5c85dce0abb6e1261187
parent3efc16e9a0c4e83c286fa2a666134455de17cffb (diff)
[FIX] purchase: null stock_moves creation
When the quantity of a purchase order line is manually decreased and if the purchase order line as been generated by more than one procurement. If the new quantity is lower than the quantity of the smallest procurement, it is impossible to validate the picking containg the stock_moves created by the purchase order validation. It is impossible to validate the picking, because it contains stock_moves with 'product_qty' set to 0. Those stock_moves are generated during the validation of a purchase order. To fix this issue, we avoid the creation of stock moves with a 'product_qty' set to 0 which has no sense.
-rw-r--r--addons/purchase/models/purchase.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py
index d41d8f62c33..a5079ba1eff 100644
--- a/addons/purchase/models/purchase.py
+++ b/addons/purchase/models/purchase.py
@@ -645,7 +645,7 @@ class PurchaseOrderLine(models.Model):
sum_existing_moves = sum(x.product_qty for x in procurement.move_ids if x.state != 'cancel')
existing_proc_qty = procurement.product_id.uom_id._compute_quantity(sum_existing_moves, procurement.product_uom)
procurement_qty = procurement.product_uom._compute_quantity(procurement.product_qty, line.product_uom) - existing_proc_qty
- if float_compare(procurement_qty, 0.0, precision_rounding=procurement.product_uom.rounding) > 0:
+ if float_compare(procurement_qty, 0.0, precision_rounding=procurement.product_uom.rounding) > 0 and float_compare(diff_quantity, 0.0, precision_rounding=line.product_uom.rounding) > 0:
tmp = template.copy()
tmp.update({
'product_uom_qty': min(procurement_qty, diff_quantity),