Commit c2f7deeb authored by Julien Muchembled's avatar Julien Muchembled

Fix causality on simulation movements

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@37881 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 05450dee
......@@ -713,9 +713,9 @@ class BusinessProcess(Path, XMLObject):
movement._edit(**kw)
business_link = self.getBusinessLinkValueList(trade_phase=trade_phase,
context=movement)
business_link = [x.getRelativeUrl() for x in business_link]
movement._setCausalityList(business_link
+ movement.getCausalityList() + amount.getCausalityList())
movement._setCausalityList([trade_model_path.getRelativeUrl()]
+ [x.getRelativeUrl() for x in business_link]
+ movement.getCausalityList())
result.append(movement)
# result can not be empty
......@@ -804,11 +804,6 @@ class BusinessProcess(Path, XMLObject):
property_dict['stop_date'] = stop_date
else:
raise TypeError("Explanation must be an Applied Rule in expand process") # Nothing to do
# Set causality to trade model path
property_dict['causality'] = trade_model_path.getRelativeUrl() # XXX-JPS Will not work if we do not use real object
#(ie. if we use kind of 'temp')
return property_dict
# IBusinessProcess global API
......
......@@ -594,7 +594,8 @@ class SimulationMovement(PropertyRecordableMixin, Movement, ExplainableMixin):
while True:
portal_type = current.getPortalType()
if portal_type == "Simulation Movement":
causality_dict[current.getCausality()] = current
causality_dict[current.getCausality(portal_type='Business Link')] = \
current
elif portal_type != "Applied Rule":
break
# XXX or maybe directly go up by two levels?
......
......@@ -90,7 +90,8 @@ class TradeModelSimulationRule(RuleMixin, MovementCollectionUpdaterMixin, Predic
class TradeModelRuleMovementGenerator(MovementGeneratorMixin):
def _getUpdatePropertyDict(self, input_movement):
return {'delivery': None,
return {'causality_list': input_movement.getCausalityList(),
'delivery': None,
# XXX shouldn't we create a tester for price instead ?
'price': input_movement.getPrice()}
......
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