[Erp5-report] r44255 jerome - /erp5/trunk/products/ERP5/mixin/rule.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Mar 14 17:31:10 CET 2011


Author: jerome
Date: Mon Mar 14 17:31:10 2011
New Revision: 44255

URL: http://svn.erp5.org?rev=44255&view=rev
Log:
when we create compensation movements to cancel an existing movement we should
not only negate its quantity but also remove the delivery link, otherwise we
create compensation movements which are already built

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

Modified: erp5/trunk/products/ERP5/mixin/rule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/mixin/rule.py?rev=44255&r1=44254&r2=44255&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/mixin/rule.py [utf8] (original)
+++ erp5/trunk/products/ERP5/mixin/rule.py [utf8] Mon Mar 14 17:31:10 2011
@@ -368,6 +368,7 @@ class RuleMixin(Predicate):
           # Compensate non deletable
           new_movement = decision_movement.asContext(
                             quantity=-decision_movement.getQuantity())
+          new_movement.setDelivery(None)
           movement_collection_diff.addNewMovement(new_movement)
       return
 
@@ -412,6 +413,7 @@ class RuleMixin(Predicate):
           if not _compare(profit_tester_list, prevision_movement, decision_movement):
             new_movement = decision_movement.asContext(
                                 quantity=-decision_movement_quantity)
+            new_movement.setDelivery(None)
             movement_collection_diff.addNewMovement(new_movement)
             compensated_quantity += decision_movement_quantity
         else:
@@ -436,6 +438,7 @@ class RuleMixin(Predicate):
           if not _compare(divergence_tester_list, prevision_movement, decision_movement):
             new_movement = decision_movement.asContext(
                                   quantity=-decision_movement_quantity)
+            new_movement.setDelivery(None)
             movement_collection_diff.addNewMovement(new_movement)
             compensated_quantity += decision_movement_quantity
         else:
@@ -472,6 +475,7 @@ class RuleMixin(Predicate):
         # It is still possible to add a new movement some movements are not
         # completed
         new_movement = prevision_movement.asContext(quantity=missing_quantity)
+        new_movement.setDelivery(None)
         movement_collection_diff.addNewMovement(new_movement)
       elif updatable_compensation_movement is not None:
         # If not, it means that all movements are completed



More information about the Erp5-report mailing list