Commit 230ffee8 authored by Łukasz Nowak's avatar Łukasz Nowak

- invert checking condition - it is needed to use base_application of trade...

 - invert checking condition - it is needed to use base_application of trade model line being inserted


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27819 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 21f65c74
......@@ -185,32 +185,26 @@ class TradeCondition(Path, Transformation, XMLMatrix):
reference = trade_model_line.getReference()
if reference not in reference_list or reference is None:
reference_list.append(reference)
base_contribution_list = trade_model_line \
.getBaseContributionList()
if len(base_contribution_list) == 0:
if len(trade_model_line.getBaseContributionList()) == 0:
# when movement will not generate anything which contributes
# it is safe to be last on list
trade_model_line_composed_list.append(trade_model_line)
else:
# if movements contributes to anything it have to be placed
# just before to what it contributes
# parse full list of currently generated trade model lines
# if current line applies to anything, put it after last
# object it applies to
index = 0
inserted = False
insert_index = 0
for old_trade_model_line in trade_model_line_composed_list:
for base_application in old_trade_model_line \
.getBaseApplicationList():
if base_application in base_contribution_list:
trade_model_line_composed_list.insert(index,
trade_model_line)
inserted = True
break
if inserted:
break
for base_application in trade_model_line \
.getBaseApplicationList():
if base_application in old_trade_model_line \
.getBaseContributionList():
insert_index = index + 1
continue
index += 1
if not inserted:
# last resort - nothing was found, it is safe to put movement
# in beginning of list
trade_model_line_composed_list.insert(0, trade_model_line)
trade_model_line_composed_list.insert(insert_index,
trade_model_line)
return trade_model_line_composed_list
......
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