[Erp5-report] r37156 yo - /erp5/trunk/products/ERP5Legacy/Document/Rule.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jul 16 04:16:16 CEST 2010


Author: yo
Date: Fri Jul 16 04:16:13 2010
New Revision: 37156

URL: http://svn.erp5.org?rev=37156&view=rev
Log:
When calculating the diff of a quantity, it is necessary to use real values instead of recorded ones.

Modified:
    erp5/trunk/products/ERP5Legacy/Document/Rule.py

Modified: erp5/trunk/products/ERP5Legacy/Document/Rule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Legacy/Document/Rule.py?rev=37156&r1=37155&r2=37156&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Legacy/Document/Rule.py [utf8] (original)
+++ erp5/trunk/products/ERP5Legacy/Document/Rule.py [utf8] Fri Jul 16 04:16:13 2010
@@ -408,14 +408,17 @@ class Rule(Predicate, XMLObject):
       if p_matched_list != []:
         # Check the quantity
         m_quantity = 0.0
+        real_quantity = 0.0
         for movement in p_matched_list:
+          quantity = movement.getQuantity()
           if movement.isPropertyRecorded('quantity'):
             m_quantity += movement.getRecordedProperty('quantity')
           else:
-            m_quantity += movement.getQuantity()
+            m_quantity += quantity
+          real_quantity += quantity
         if m_quantity != prevision.get('quantity'):
           # special case - quantity
-          q_diff = prevision.get('quantity') - m_quantity
+          q_diff = prevision.get('quantity') - real_quantity
           # try to find a movement that can be edited
           for movement in p_matched_list:
             if movement in (mutable_movement_list \




More information about the Erp5-report mailing list