From 7f0c1ec480a8b79f98b2cc1af863e4c8333bcdfb Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Thu, 9 Jun 2005 09:26:10 +0000 Subject: [PATCH] Bug fix: correct a division by zero. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3225 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/DeliveryBuilder.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/product/ERP5/Document/DeliveryBuilder.py b/product/ERP5/Document/DeliveryBuilder.py index d301840b94..62fdfb11f4 100755 --- a/product/ERP5/Document/DeliveryBuilder.py +++ b/product/ERP5/Document/DeliveryBuilder.py @@ -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) -- 2.30.9