From 92a5e46303fb5cfc61df5830b4590ad31605f159 Mon Sep 17 00:00:00 2001 From: Sebastien Robin <seb@nexedi.com> Date: Tue, 6 Dec 2005 08:59:56 +0000 Subject: [PATCH] make sure to give all arguments to all levels when doing expand git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4499 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/SimulationMovement.py | 13 ++++++------- product/ERP5/Document/TransformationRule.py | 2 +- product/ERP5/Document/TransformationSourcingRule.py | 11 ++++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/product/ERP5/Document/SimulationMovement.py b/product/ERP5/Document/SimulationMovement.py index 80a6bdd5a1..362645f483 100755 --- a/product/ERP5/Document/SimulationMovement.py +++ b/product/ERP5/Document/SimulationMovement.py @@ -224,8 +224,8 @@ class SimulationMovement(Movement): # Parse each rule and test if it applies for rule in portal_rules.objectValues(): if rule.test(self): - my_applied_rule = rule.constructNewAppliedRule(self) - my_applied_rule.expand() + my_applied_rule = rule.constructNewAppliedRule(self,**kw) + my_applied_rule.expand(**kw) # Set to expanded self.setCausalityState('expanded') @@ -476,23 +476,22 @@ class SimulationMovement(Movement): # "method: %s, self: %s , delivery: %s" % \ # tuple([method]+[str(getattr(x,method)()) for x in (self, delivery)])) return 1 - d_quantity = delivery.getQuantity() - if d_quantity is None: - d_quantity = 0 quantity = self.getCorrectedQuantity() d_error = self.getDeliveryError() if quantity is None: if d_quantity is None: return 0 return 1 + if d_quantity is None: + d_quantity = 0 if d_error is None: d_error = 0 delivery_ratio = self.getDeliveryRatio() - if delivery_ratio is not None: - d_quantity *= delivery_ratio #LOG('SimulationMovement.isDivergent d_quantity',0,d_quantity) #LOG('SimulationMovement.isDivergent quantity + d_error',0,quantity + d_error) + if delivery_ratio is not None: + d_quantity *= delivery_ratio if d_quantity != quantity + d_error: return 1 return 0 diff --git a/product/ERP5/Document/TransformationRule.py b/product/ERP5/Document/TransformationRule.py index 7209613fdf..deff206b37 100755 --- a/product/ERP5/Document/TransformationRule.py +++ b/product/ERP5/Document/TransformationRule.py @@ -135,7 +135,7 @@ class TransformationRule(Rule): current_supply_link) movement_dict.update(consumed_mvt_dict) # Finally, build movement - self._buildMovementList(applied_rule, movement_dict) + self._buildMovementList(applied_rule, movement_dict,**kw) # Expand each movement created Rule.expand(self, applied_rule, **kw) diff --git a/product/ERP5/Document/TransformationSourcingRule.py b/product/ERP5/Document/TransformationSourcingRule.py index c5bcfe49a4..e8ac1e4f9c 100755 --- a/product/ERP5/Document/TransformationSourcingRule.py +++ b/product/ERP5/Document/TransformationSourcingRule.py @@ -74,7 +74,7 @@ class TransformationSourcingRuleMixin(ExtensionClass.Base): security.declareProtected(Permissions.ModifyPortalContent, '_buildMovementList') - def _buildMovementList(self, applied_rule, movement_dict): + def _buildMovementList(self, applied_rule, movement_dict,activate_kw=None,**kw): """ For each movement in the dictionnary, test if the movement already exists. @@ -87,7 +87,8 @@ class TransformationSourcingRuleMixin(ExtensionClass.Base): if movement is None: movement = applied_rule.newContent( portal_type=self.simulation_movement_portal_type, - id=movement_id + id=movement_id, + activate_kw=activate_kw ) # Update movement properties movement.edit(**(movement_dict[movement_id])) @@ -180,7 +181,7 @@ class TransformationSourcingRule(Rule): """ security.declareProtected(Permissions.ModifyPortalContent, 'expand') - def expand(self, applied_rule, **kw): + def expand(self, applied_rule, activate_kw=None,**kw): """ Expands the current movement downward. -> new status -> expanded @@ -232,9 +233,9 @@ class TransformationSourcingRule(Rule): } }) # Build the movement - self._buildMovementList(applied_rule, movement_dict) + self._buildMovementList(applied_rule, movement_dict,activate_kw=activate_kw) # Create one submovement which sources the transformation - Rule.expand(self, applied_rule, **kw) + Rule.expand(self, applied_rule, activate_kw=activate_kw, **kw) security.declareProtected(Permissions.ModifyPortalContent, 'solve') def solve(self, applied_rule, solution_list): -- 2.30.9