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