Commit 92a5e463 authored by Sebastien Robin's avatar Sebastien Robin

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
parent 299afa30
......@@ -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
......
......@@ -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)
......
......@@ -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):
......
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