[Erp5-report] r10150 - /erp5/trunk/products/ERP5/Document/InvoicingRule.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Sep 19 13:41:48 CEST 2006


Author: rafael
Date: Tue Sep 19 13:41:45 2006
New Revision: 10150

URL: http://svn.erp5.org?rev=10150&view=rev
Log:
The invoicing rule expand was over-wrinting with old values the properties 
in the simulation movements.

This fix one part of testInvoice, but still they fail because the floating Problem.

Modified:
    erp5/trunk/products/ERP5/Document/InvoicingRule.py

Modified: erp5/trunk/products/ERP5/Document/InvoicingRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/InvoicingRule.py?rev=10150&r1=10149&r2=10150&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/InvoicingRule.py (original)
+++ erp5/trunk/products/ERP5/Document/InvoicingRule.py Tue Sep 19 13:41:45 2006
@@ -138,28 +138,31 @@
         modify, remove)
     - add/modify/remove child movements to match prevision
     """
-    add_list, modify_dict, \
-        delete_list = self._getCompensatedMovementList(applied_rule, **kw)
-
-    for movement_id in delete_list:
-      applied_rule._delObject(movement_id)
+    parent_movement = applied_rule.getParentValue()
+    if parent_movement is not None: 
+      if not parent_movement.isFrozen():
+        add_list, modify_dict, \
+          delete_list = self._getCompensatedMovementList(applied_rule, **kw)
+
+        for movement_id in delete_list:
+          applied_rule._delObject(movement_id)
       
-    for movement, prop_dict in modify_dict.items():
-      #XXX ignore start_date and stop_date if the difference is smaller than a
-      # rule defined value
-      for prop in ('start_date', 'stop_date'):
-        if prop in prop_dict.keys():
-          prop_dict.pop(prop)
-      applied_rule[movement].edit(**prop_dict)
-
-    for movement_dict in add_list:
-      if 'id' in movement_dict.keys():
-        mvmt_id = applied_rule._get_id(movement_dict.pop('id'))
-        new_mvmt = applied_rule.newContent(id=mvmt_id,
-            portal_type=self.movement_type)
-      else:
-        new_mvmt = applied_rule.newContent(portal_type=self.movement_type)
-      new_mvmt.edit(**movement_dict)
+        for movement, prop_dict in modify_dict.items():
+          #XXX ignore start_date and stop_date if the difference is smaller than a
+          # rule defined value
+          for prop in ('start_date', 'stop_date'):
+           if prop in prop_dict.keys():
+              prop_dict.pop(prop)
+          applied_rule[movement].edit(**prop_dict)
+
+        for movement_dict in add_list:
+          if 'id' in movement_dict.keys():
+            mvmt_id = applied_rule._get_id(movement_dict.pop('id'))
+            new_mvmt = applied_rule.newContent(id=mvmt_id,
+                portal_type=self.movement_type)
+          else:
+            new_mvmt = applied_rule.newContent(portal_type=self.movement_type)
+          new_mvmt.edit(**movement_dict)
 
     # Pass to base class
     Rule.expand(self, applied_rule, force=force, **kw)




More information about the Erp5-report mailing list