Commit 7f0c1ec4 authored by Romain Courteaud's avatar Romain Courteaud

Bug fix: correct a division by zero.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3225 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1801a8ae
......@@ -515,10 +515,11 @@ class DeliveryBuilder(XMLObject, Amount, Predicate):
quantity = simulation_movement.getQuantity()
simulation_movement.setDeliveryRatio(quantity/total_quantity)
else:
# Distribute equally ratio to all movement
mvt_ratio = 1 / len(sim_mvt_list)
for simulation_movement in sim_mvt_list:
simulation_movement.setDeliveryRatio(mvt_ratio)
if len(sim_mvt_list) != 0:
# Distribute equally ratio to all movement
mvt_ratio = 1 / len(sim_mvt_list)
for simulation_movement in sim_mvt_list:
simulation_movement.setDeliveryRatio(mvt_ratio)
movement.edit(quantity=total_quantity)
......
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