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):
aggregated_amount_list = self.getAggregatedAmountList(context=context,
movement_list=movement_list, **kw)
modified_reference_list = []
normal_use_list = self.getPortalObject().portal_preferences\
.getPreferredNormalResourceUseCategoryList()
# check if the existing movements are in aggregated movements
movement_to_delete_list = []
for movement in existing_movement_list:
keep_movement = False
# check if the movement is a generated one or entered by the user.
# If it has been entered by user, keep it.
resource = movement.getResourceValue()
if resource is not None and \
len(set(normal_use_list).intersection(set(resource\
.getUseList()))):
if not movement.getBaseApplicationList():
keep_movement = True
continue
for amount in aggregated_amount_list:
......
......@@ -116,12 +116,6 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
if current_aggregated_amount_list is None:
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,
# otherwise it is needed to look up for movements
if len(movement_list) == 0:
......@@ -137,11 +131,8 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
# add only movement which are input (i.e. resource use category
# is in the normal resource use preference list). Output will
# be recalculated
movement_resource = movement.getResourceValue()
if movement_resource is not None:
if movement_resource.getUse() in \
normal_resource_use_category_list:
movement_list.append(movement)
if not movement.getBaseApplication():
movement_list.append(movement)
aggregated_amount_list = AggregatedAmountList()
base_application_list = self.getBaseApplicationList()
......
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