Commit dc019716 authored by Sebastien Robin's avatar Sebastien Robin

allow to pass more parameters


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4211 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0a9c6cab
...@@ -520,7 +520,7 @@ class Delivery(XMLObject): ...@@ -520,7 +520,7 @@ class Delivery(XMLObject):
my_applied_rule.setCausalityValue(self) my_applied_rule.setCausalityValue(self)
# We must make sure this rule is indexed # We must make sure this rule is indexed
# now in order not to create another one later # now in order not to create another one later
my_applied_rule.reindexObject() my_applied_rule.reindexObject(**kw)
elif len(my_applied_rule_list) == 1: elif len(my_applied_rule_list) == 1:
# Re expand the rule if possible # Re expand the rule if possible
my_applied_rule = my_applied_rule_list[0] my_applied_rule = my_applied_rule_list[0]
...@@ -533,7 +533,8 @@ class Delivery(XMLObject): ...@@ -533,7 +533,8 @@ class Delivery(XMLObject):
self.activate( self.activate(
after_path_and_method_id=( after_path_and_method_id=(
my_applied_rule.getPath(), my_applied_rule.getPath(),
['immediateReindexObject', 'recursiveImmediateReindexObject']) ['immediateReindexObject', 'recursiveImmediateReindexObject']),
**kw
).expand(my_applied_rule.getId(),force=force,**kw) ).expand(my_applied_rule.getId(),force=force,**kw)
security.declareProtected(Permissions.ModifyPortalContent, 'expand') security.declareProtected(Permissions.ModifyPortalContent, 'expand')
......
...@@ -100,7 +100,7 @@ class DeliveryBuilder(OrderBuilder): ...@@ -100,7 +100,7 @@ class DeliveryBuilder(OrderBuilder):
""" """
pass pass
def searchMovementList(self, applied_rule_uid=None): def searchMovementList(self, applied_rule_uid=None,**kw):
""" """
defines how to query all Simulation Movements which meet certain criteria defines how to query all Simulation Movements which meet certain criteria
(including the above path path definition). (including the above path path definition).
...@@ -109,7 +109,6 @@ class DeliveryBuilder(OrderBuilder): ...@@ -109,7 +109,6 @@ class DeliveryBuilder(OrderBuilder):
Then, call script simulation_select_method to restrict movement_list Then, call script simulation_select_method to restrict movement_list
""" """
movement_list = [] movement_list = []
kw = {}
# We only search Simulation Movement # We only search Simulation Movement
kw['portal_type'] = 'Simulation Movement' kw['portal_type'] = 'Simulation Movement'
# Search only child movement from this applied rule # Search only child movement from this applied rule
......
...@@ -137,10 +137,10 @@ class Order(Delivery): ...@@ -137,10 +137,10 @@ class Order(Delivery):
########################################################################## ##########################################################################
# Applied Rule stuff # Applied Rule stuff
def updateAppliedRule(self, rule_id="default_order_rule",force=0): def updateAppliedRule(self, rule_id="default_order_rule",force=0,**kw):
""" """
XXX FIXME: Kept for compatibility XXX FIXME: Kept for compatibility
updateAppliedRule must be call with the rule_id in workflow script updateAppliedRule must be call with the rule_id in workflow script
""" """
Delivery.updateAppliedRule(self, rule_id, force=force) Delivery.updateAppliedRule(self, rule_id, force=force,**kw)
...@@ -90,7 +90,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -90,7 +90,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
security.declareProtected(Permissions.ModifyPortalContent, 'build') security.declareProtected(Permissions.ModifyPortalContent, 'build')
def build(self, applied_rule_uid=None, movement_relative_url_list=None, def build(self, applied_rule_uid=None, movement_relative_url_list=None,
delivery_relative_url_list=None): delivery_relative_url_list=None,**kw):
""" """
Build deliveries from a list of movements Build deliveries from a list of movements
...@@ -108,7 +108,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -108,7 +108,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
# Select # Select
if movement_relative_url_list == []: if movement_relative_url_list == []:
movement_list = self.searchMovementList( movement_list = self.searchMovementList(
applied_rule_uid=applied_rule_uid) applied_rule_uid=applied_rule_uid,**kw)
else: else:
movement_list = [self.restrictedTraverse(relative_url) for relative_url \ movement_list = [self.restrictedTraverse(relative_url) for relative_url \
in movement_relative_url_list] in movement_relative_url_list]
...@@ -118,9 +118,9 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -118,9 +118,9 @@ class OrderBuilder(XMLObject, Amount, Predicate):
delivery_list = self.buildDeliveryList( delivery_list = self.buildDeliveryList(
root_group, root_group,
delivery_relative_url_list=delivery_relative_url_list, delivery_relative_url_list=delivery_relative_url_list,
movement_list=movement_list) movement_list=movement_list,**kw)
# Call a script after building # Call a script after building
self.callAfterBuildingScript(delivery_list) self.callAfterBuildingScript(delivery_list,**kw)
# XXX Returning the delivery list is probably not necessary # XXX Returning the delivery list is probably not necessary
return delivery_list return delivery_list
...@@ -140,7 +140,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -140,7 +140,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
delivery_module = getattr(self, self.getDeliveryModule()) delivery_module = getattr(self, self.getDeliveryModule())
getattr(delivery_module, delivery_module_before_building_script_id)() getattr(delivery_module, delivery_module_before_building_script_id)()
def searchMovementList(self, applied_rule_uid=None): def searchMovementList(self, applied_rule_uid=None,**kw):
""" """
Defines how to query all Simulation Movements which meet certain Defines how to query all Simulation Movements which meet certain
criteria (including the above path path definition). criteria (including the above path path definition).
...@@ -151,7 +151,6 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -151,7 +151,6 @@ class OrderBuilder(XMLObject, Amount, Predicate):
""" """
from Products.ERP5Type.Document import newTempMovement from Products.ERP5Type.Document import newTempMovement
movement_list = [] movement_list = []
kw = {}
for attribute, method in [('node_uid', 'getDestinationUid'), for attribute, method in [('node_uid', 'getDestinationUid'),
('section_uid', 'getDestinationSectionUid')]: ('section_uid', 'getDestinationSectionUid')]:
if getattr(self, method)() not in ("", None): if getattr(self, method)() not in ("", None):
...@@ -261,7 +260,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -261,7 +260,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
return result return result
def buildDeliveryList(self, movement_group, delivery_relative_url_list=None, def buildDeliveryList(self, movement_group, delivery_relative_url_list=None,
movement_list=None): movement_list=None,**kw):
""" """
Build deliveries from a list of movements Build deliveries from a list of movements
""" """
...@@ -511,7 +510,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -511,7 +510,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
#simulation_movement.setDeliveryRatio(1) #simulation_movement.setDeliveryRatio(1)
simulation_movement.edit(delivery_ratio=1) simulation_movement.edit(delivery_ratio=1)
def callAfterBuildingScript(self, delivery_list): def callAfterBuildingScript(self, delivery_list,**kw):
""" """
Call script on each delivery built Call script on each delivery built
""" """
......
...@@ -113,9 +113,9 @@ class PackingList(Delivery): ...@@ -113,9 +113,9 @@ class PackingList(Delivery):
########################################################################## ##########################################################################
# Applied Rule stuff # Applied Rule stuff
def updateAppliedRule(self, rule_id="default_delivery_rule"): def updateAppliedRule(self, rule_id="default_delivery_rule",**kw):
""" """
XXX FIXME: Kept for compatibility XXX FIXME: Kept for compatibility
updateAppliedRule must be call with the rule_id in workflow script updateAppliedRule must be call with the rule_id in workflow script
""" """
Delivery.updateAppliedRule(self, rule_id) Delivery.updateAppliedRule(self, rule_id,**kw)
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