[Erp5-report] r27603 - /erp5/trunk/products/ERP5/Document/TradeCondition.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Jun 16 14:55:34 CEST 2009


Author: luke
Date: Tue Jun 16 14:55:30 2009
New Revision: 27603

URL: http://svn.erp5.org?rev=27603&view=rev
Log:
 - set proper security for updateAggregatedAmountList - it will modify context, not self, so ACI is enough
 - simplify loop into list operation
 - move parameter initialisation to top

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

Modified: erp5/trunk/products/ERP5/Document/TradeCondition.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TradeCondition.py?rev=27603&r1=27602&r2=27603&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TradeCondition.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TradeCondition.py [utf8] Tue Jun 16 14:55:30 2009
@@ -79,7 +79,7 @@
 
     zope.interface.implements(interfaces.ITransformation)
 
-    security.declareProtected(Permissions.ModifyPortalContent,
+    security.declareProtected(Permissions.AccessContentsInformation,
                               'updateAggregatedAmountList')
     def updateAggregatedAmountList(self, context, **kw):
       existing_movement_list = context.getMovementList()
@@ -212,14 +212,14 @@
     security.declareProtected(Permissions.AccessContentsInformation,
                               'getAggregatedAmountList')
     def getAggregatedAmountList(self, context, movement_list=None, **kw):
+      if movement_list is None:
+        movement_list = []
       result = AggregatedAmountList()
 
       trade_model_line_composed_list = \
           self.getTradeModelLineComposedList(context)
 
       need_to_run = 1
-      if movement_list is None:
-        movement_list = []
       while need_to_run:
         need_to_run = 0
         for model_line in trade_model_line_composed_list:
@@ -234,11 +234,8 @@
           movement_list = result
 
       # remove movement that should not be created
-      final_list = []
-      for movement in result:
-        if movement.getCausalityValue().getCreateLine():
-          final_list.append(movement)
-      return final_list
+      result = [movement for movement in result if movement.getCausalityValue().getCreateLine()]
+      return result
 
     security.declareProtected( Permissions.AccessContentsInformation, 'getCell')
     def getCell(self, *kw , **kwd):




More information about the Erp5-report mailing list