Commit fa061a33 authored by Jérome Perrin's avatar Jérome Perrin

same as r45795, prevent division by zero with movement that have zero quantity


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45796 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6f10b2f1
...@@ -77,8 +77,11 @@ class MinimisePriceDeliverySolver(FIFODeliverySolver): ...@@ -77,8 +77,11 @@ class MinimisePriceDeliverySolver(FIFODeliverySolver):
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