Commit 5fb56a73 authored by Łukasz Nowak's avatar Łukasz Nowak

- there is no need to use use category of resource to recognise if movements...

 - there is no need to use use category of resource to recognise if movements are put by user or by system, empty base_application suggest that movement is set by user


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28794 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7c5994c1
...@@ -85,18 +85,13 @@ class TradeCondition(Path, Transformation, XMLMatrix): ...@@ -85,18 +85,13 @@ class TradeCondition(Path, Transformation, XMLMatrix):
aggregated_amount_list = self.getAggregatedAmountList(context=context, aggregated_amount_list = self.getAggregatedAmountList(context=context,
movement_list=movement_list, **kw) movement_list=movement_list, **kw)
modified_reference_list = [] modified_reference_list = []
normal_use_list = self.getPortalObject().portal_preferences\
.getPreferredNormalResourceUseCategoryList()
# check if the existing movements are in aggregated movements # check if the existing movements are in aggregated movements
movement_to_delete_list = [] movement_to_delete_list = []
for movement in existing_movement_list: for movement in existing_movement_list:
keep_movement = False keep_movement = False
# check if the movement is a generated one or entered by the user. # check if the movement is a generated one or entered by the user.
# If it has been entered by user, keep it. # If it has been entered by user, keep it.
resource = movement.getResourceValue() if not movement.getBaseApplicationList():
if resource is not None and \
len(set(normal_use_list).intersection(set(resource\
.getUseList()))):
keep_movement = True keep_movement = True
continue continue
for amount in aggregated_amount_list: for amount in aggregated_amount_list:
......
...@@ -116,12 +116,6 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): ...@@ -116,12 +116,6 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
if current_aggregated_amount_list is None: if current_aggregated_amount_list is None:
current_aggregated_amount_list = [] current_aggregated_amount_list = []
normal_resource_use_category_list = self.\
portal_preferences.getPreferredNormalResourceUseCategoryList()
if normal_resource_use_category_list is None:
raise ValueError('preferred_normal_resource_use_category is not ' + \
'configured in System Preferences')
# if movement_list is passed as parameter, it shall be used, # if movement_list is passed as parameter, it shall be used,
# otherwise it is needed to look up for movements # otherwise it is needed to look up for movements
if len(movement_list) == 0: if len(movement_list) == 0:
...@@ -137,10 +131,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): ...@@ -137,10 +131,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
# add only movement which are input (i.e. resource use category # add only movement which are input (i.e. resource use category
# is in the normal resource use preference list). Output will # is in the normal resource use preference list). Output will
# be recalculated # be recalculated
movement_resource = movement.getResourceValue() if not movement.getBaseApplication():
if movement_resource is not None:
if movement_resource.getUse() in \
normal_resource_use_category_list:
movement_list.append(movement) movement_list.append(movement)
aggregated_amount_list = AggregatedAmountList() aggregated_amount_list = AggregatedAmountList()
......
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