Commit 6f10b2f1 authored by Jérome Perrin's avatar Jérome Perrin

prevent division by zero with movement that have zero quantity


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45795 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fb707d33
...@@ -84,8 +84,11 @@ class FIFODeliverySolver(XMLObject): ...@@ -84,8 +84,11 @@ class FIFODeliverySolver(XMLObject):
else: else:
result.append((movement, remaining_quantity)) result.append((movement, remaining_quantity))
movement_quantity = quantity - remaining_quantity movement_quantity = quantity - remaining_quantity
delivery_ratio = 1.
if new_quantity:
delivery_ratio = movement_quantity / new_quantity
movement.edit(quantity=movement_quantity, movement.edit(quantity=movement_quantity,
delivery_ratio=movement_quantity / new_quantity, delivery_ratio=delivery_ratio,
activate_kw=activate_kw) activate_kw=activate_kw)
remaining_quantity = 0 remaining_quantity = 0
# Return movement, split_quantity tuples # Return movement, split_quantity tuples
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment