[Erp5-report] r28257 - /erp5/trunk/products/ERP5/Document/BPMRule.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Aug 3 18:09:42 CEST 2009


Author: luke
Date: Mon Aug  3 18:09:40 2009
New Revision: 28257

URL: http://svn.erp5.org?rev=28257&view=rev
Log:
 - properly raise in case for compensation
 - fix docstring a little

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

Modified: erp5/trunk/products/ERP5/Document/BPMRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BPMRule.py?rev=28257&r1=28256&r2=28257&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BPMRule.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BPMRule.py [utf8] Mon Aug  3 18:09:40 2009
@@ -238,10 +238,9 @@
     return input_movement_and_path_list
 
   def _getCompensatedMovementList(self, applied_rule, **kw):
-    """
-    Compute the difference between prevision and existing movements
-
-    immutable movements need compensation, mutables needs to be modified
+    """Compute the difference between prevision and existing movements
+
+    Immutable movements need compensation, mutable ones needs to be modified
 
     XXX For now, this implementation is too simple. It could be improved by
     using MovementGroups
@@ -285,10 +284,9 @@
               prop_dict['quantity'] = movement.getQuantity() + \
                   q_diff
               break
-          # no modifiable movement was found, need to create one
           else:
-            prevision['quantity'] = q_diff
-            add_list.append(prevision)
+            # no modifiable movement was found, need to compensate by quantity
+            raise NotImplementedError('Need to generate quantity compensation')
 
         # Check the date
         for movement in p_matched_list:
@@ -326,9 +324,8 @@
       else:
         # movement not modifiable, we can decide to create a compensation
         # with negative quantity
-        raise NotImplementedError(
-                "Can not create a compensation movement for %s" % \
-                movement.getRelativeUrl())
+        raise NotImplementedError("Tried to delete immutable movement %s" % \
+            movement.getRelativeUrl())
     return (add_list, modify_dict, delete_list)
 
   def _getExpandablePropertyDict(self, applied_rule, movement, business_path,




More information about the Erp5-report mailing list