Commit 3ac345c3 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Fix the way of passing a rule to Delivery.updateAppliedRule, and correct a warning message.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18401 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9a5a6dc5
......@@ -35,6 +35,7 @@ from Products.ERP5Type.Base import Base
from Products.ERP5.Document.Delivery import Delivery
from zLOG import LOG
from warnings import warn
class Order(Delivery):
# CMF Type Definition
......@@ -136,13 +137,18 @@ class Order(Delivery):
##########################################################################
# Applied Rule stuff
def updateAppliedRule(self, rule_id="default_order_rule",force=0,**kw):
def updateAppliedRule(self, rule_id=None, rule_reference=None, **kw):
"""XXX FIXME: Kept for compatibility.
updateAppliedRule must be called with a rule_reference in a workflow
script.
"""
XXX FIXME: Kept for compatibility
updateAppliedRule must be call with the rule_id in workflow script
"""
LOG('Order.updateAppliedRule ',0,'This method this method should not be used anymore.')
Delivery.updateAppliedRule(self, rule_id, force=force,**kw)
if rule_id is None and rule_reference is None:
warn('Relying on a default order rule is deprecated; ' \
'rule_reference must be specified explicitly.',
DeprecationWarning)
rule_reference = 'default_order_rule'
Delivery.updateAppliedRule(self, rule_id=rule_id,
rule_reference=rule_reference, **kw)
def expandAppliedRuleRelatedToOrder(self, activate_kw=None,**kw):
"""
......
......@@ -32,6 +32,7 @@ from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.Delivery import Delivery
from zLOG import LOG
from warnings import warn
class PackingList(Delivery):
"""
......@@ -122,9 +123,15 @@ class PackingList(Delivery):
##########################################################################
# Applied Rule stuff
def updateAppliedRule(self, rule_id="default_delivery_rule", **kw):
def updateAppliedRule(self, rule_id=None, rule_reference=None, **kw):
"""XXX FIXME: Kept for compatibility.
updateAppliedRule must be called with a rule_reference in a workflow
script.
"""
XXX FIXME: Kept for compatibility
updateAppliedRule must be call with the rule_id in workflow script
"""
Delivery.updateAppliedRule(self, rule_id, **kw)
if rule_id is None and rule_reference is None:
warn('Relying on a default order rule is deprecated; ' \
'rule_reference must be specified explicitly.',
DeprecationWarning)
rule_reference = 'default_delivery_rule'
Delivery.updateAppliedRule(self, rule_id=rule_id,
rule_reference=rule_reference, **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