[Erp5-report] r42692 jm - /erp5/trunk/products/ERP5/mixin/amount_generator.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jan 26 16:12:18 CET 2011


Author: jm
Date: Wed Jan 26 16:12:18 2011
New Revision: 42692

URL: http://svn.erp5.org?rev=42692&view=rev
Log:
amount_generator: backward compatibility for TTR with efficiency=0

Modified:
    erp5/trunk/products/ERP5/mixin/amount_generator.py

Modified: erp5/trunk/products/ERP5/mixin/amount_generator.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/mixin/amount_generator.py?rev=42692&r1=42691&r2=42692&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/mixin/amount_generator.py [utf8] (original)
+++ erp5/trunk/products/ERP5/mixin/amount_generator.py [utf8] Wed Jan 26 16:12:18 2011
@@ -319,8 +319,11 @@ class AmountGeneratorMixin:
           amount = getRoundingProxy(amount, context=self)
         result.append(amount)
         # Contribute
-        quantity *= property_dict.get('price', 1) / \
-                    property_dict.get('efficiency', 1)
+        quantity *= property_dict.get('price', 1)
+        try:
+          quantity /= property_dict.get('efficiency', 1)
+        except ZeroDivisionError:
+          quantity *= float('inf')
         for base_contribution in property_dict['base_contribution_set']:
           base_amount.contribute(base_contribution, quantity)
 



More information about the Erp5-report mailing list