Commit 8d13a6f9 authored by Łukasz Nowak's avatar Łukasz Nowak

- set proper security for updateAggregatedAmountList - it will modify...

 - 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


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27603 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c64fe188
...@@ -79,7 +79,7 @@ class TradeCondition(Path, Transformation, XMLMatrix): ...@@ -79,7 +79,7 @@ class TradeCondition(Path, Transformation, XMLMatrix):
zope.interface.implements(interfaces.ITransformation) zope.interface.implements(interfaces.ITransformation)
security.declareProtected(Permissions.ModifyPortalContent, security.declareProtected(Permissions.AccessContentsInformation,
'updateAggregatedAmountList') 'updateAggregatedAmountList')
def updateAggregatedAmountList(self, context, **kw): def updateAggregatedAmountList(self, context, **kw):
existing_movement_list = context.getMovementList() existing_movement_list = context.getMovementList()
...@@ -212,14 +212,14 @@ class TradeCondition(Path, Transformation, XMLMatrix): ...@@ -212,14 +212,14 @@ class TradeCondition(Path, Transformation, XMLMatrix):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getAggregatedAmountList') 'getAggregatedAmountList')
def getAggregatedAmountList(self, context, movement_list=None, **kw): def getAggregatedAmountList(self, context, movement_list=None, **kw):
if movement_list is None:
movement_list = []
result = AggregatedAmountList() result = AggregatedAmountList()
trade_model_line_composed_list = \ trade_model_line_composed_list = \
self.getTradeModelLineComposedList(context) self.getTradeModelLineComposedList(context)
need_to_run = 1 need_to_run = 1
if movement_list is None:
movement_list = []
while need_to_run: while need_to_run:
need_to_run = 0 need_to_run = 0
for model_line in trade_model_line_composed_list: for model_line in trade_model_line_composed_list:
...@@ -234,11 +234,8 @@ class TradeCondition(Path, Transformation, XMLMatrix): ...@@ -234,11 +234,8 @@ class TradeCondition(Path, Transformation, XMLMatrix):
movement_list = result movement_list = result
# remove movement that should not be created # remove movement that should not be created
final_list = [] result = [movement for movement in result if movement.getCausalityValue().getCreateLine()]
for movement in result: return result
if movement.getCausalityValue().getCreateLine():
final_list.append(movement)
return final_list
security.declareProtected( Permissions.AccessContentsInformation, 'getCell') security.declareProtected( Permissions.AccessContentsInformation, 'getCell')
def getCell(self, *kw , **kwd): def getCell(self, *kw , **kwd):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment