Commit bde0bb0c authored by Jérome Perrin's avatar Jérome Perrin

Force the transition id in workflow method generation.

For rare cases where transition's name differs from method name and the workflow method has already been created by an interraction workflow who doesn't knows original transition name (happens with set_ready from packing_list_workflow and setReady in delivery_edit_workflow)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5675 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6a395ac1
......@@ -90,6 +90,9 @@ class WorkflowMethod(Method):
id = method.__name__
self._id = id
def _setId(self, id) :
self._id = id
def __call__(self, instance, *args, **kw):
"""
Invoke the wrapped method, and deal with the results.
......@@ -264,8 +267,6 @@ def initializePortalTypeDynamicWorkflowMethods(self, klass, prop_holder):
prop_holder.security.declareProtected(
Permissions.AccessContentsInformation,
method_id )
# LOG('in aq_portal_type %s' % id, 0,
# "added transition method %s" % method_id)
else:
# Wrap method into WorkflowMethod is needed
try:
......@@ -280,6 +281,15 @@ def initializePortalTypeDynamicWorkflowMethods(self, klass, prop_holder):
if not isinstance(method, WorkflowMethod):
setattr(work_method_holder, method_id,
WorkflowMethod(method, method_id))
else :
# some methods (eg. set_ready) doesn't have the same name
# (setReady) as the workflow transition (set_ready).
# If they are associated with both an InteractionWorkflow
# and a DCWorkflow, and the WorkflowMethod is created for
# the InterractionWorkflow, then it may be associated with
# a wrong transition name (setReady).
# Here we force it's id to be the transition name (set_ready).
method._setId(tr_id)
else:
LOG('initializePortalTypeDynamicWorkflowMethods', 100,
'WARNING! Can not initialize %s on %s' % \
......
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