From c2f7deeb8d776563edb4f1bcd7ad2027c134926d Mon Sep 17 00:00:00 2001 From: Julien Muchembled <jm@nexedi.com> Date: Wed, 18 Aug 2010 11:46:42 +0000 Subject: [PATCH] Fix causality on simulation movements git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@37881 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/BusinessProcess.py | 11 +++-------- product/ERP5/Document/SimulationMovement.py | 3 ++- product/ERP5/Document/TradeModelSimulationRule.py | 3 ++- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/product/ERP5/Document/BusinessProcess.py b/product/ERP5/Document/BusinessProcess.py index edecf98814..0fc697143f 100644 --- a/product/ERP5/Document/BusinessProcess.py +++ b/product/ERP5/Document/BusinessProcess.py @@ -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 diff --git a/product/ERP5/Document/SimulationMovement.py b/product/ERP5/Document/SimulationMovement.py index ed65084cb8..7400de5ea2 100644 --- a/product/ERP5/Document/SimulationMovement.py +++ b/product/ERP5/Document/SimulationMovement.py @@ -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? diff --git a/product/ERP5/Document/TradeModelSimulationRule.py b/product/ERP5/Document/TradeModelSimulationRule.py index e9160e0a28..124e0f6231 100644 --- a/product/ERP5/Document/TradeModelSimulationRule.py +++ b/product/ERP5/Document/TradeModelSimulationRule.py @@ -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()} -- 2.30.9