From bd8f61989b9e7aea5fa9b4cb20b886e6b2e3370f Mon Sep 17 00:00:00 2001
From: Alexandre Boeglin <alex@nexedi.com>
Date: Wed, 12 Mar 2008 10:20:51 +0000
Subject: [PATCH] should not try to divide by none or 0

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19815 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/Resource.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/product/ERP5/Document/Resource.py b/product/ERP5/Document/Resource.py
index d8355c3331..0ce460ead9 100644
--- a/product/ERP5/Document/Resource.py
+++ b/product/ERP5/Document/Resource.py
@@ -721,8 +721,9 @@ class Resource(XMLMatrix, Variated):
         for surcharge_ratio in price_parameter_dict['surcharge_ratio']:
           sum_surcharge_ratio += surcharge_ratio
         unit_base_price = unit_base_price * sum_surcharge_ratio
-      # Divide by the priced quantity
-      if unit_base_price is not None:
+      # Divide by the priced quantity if not (None, 0)
+      if unit_base_price is not None\
+          and price_parameter_dict['priced_quantity']:
         priced_quantity = price_parameter_dict['priced_quantity']
         unit_base_price = unit_base_price / priced_quantity
       # Return result
-- 
2.30.9