Commit b1d54882 authored by iv's avatar iv

ERP5Workflow: compute correctly the transition id

In case of workflow being a DCWorkflow (from wf_id or workflow_list),
we should get the transition id according to the old DC workflow
transition ids (ex: plan_action and not transition_plan_action).
parent c589e844
...@@ -193,26 +193,24 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -193,26 +193,24 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
wf_id=None, *args, **kw): wf_id=None, *args, **kw):
workflow_id = wf_id workflow_id = wf_id
workflow_list = self.getWorkflowsFor(current_object.getPortalType()) workflow_list = self.getWorkflowsFor(current_object.getPortalType())
action_id = action_reference action_id = ''
if workflow_id is None: if workflow_id is None:
if workflow_list == []: if workflow_list == []:
raise WorkflowException(_(u'No workflows found.')) raise WorkflowException(_(u'No workflows found.'))
found = 0 found = 0
for workflow in workflow_list: for workflow in workflow_list:
if workflow.getPortalType() == 'Workflow': action_id = workflow.getTransitionIdByReference(action_reference)
action_id = workflow.getTransitionIdByReference(action_reference)
if workflow.isActionSupported(current_object, action_id, **kw): if workflow.isActionSupported(current_object, action_id, **kw):
found = 1 found = 1
break break
if not found: if not found:
message = "No workflow provides the %s action." % action_id message = "No workflow provides the %s action." % action_reference
raise WorkflowException(message) raise WorkflowException(message)
else: else:
workflow = self.getWorkflowById(workflow_id) workflow = self.getWorkflowById(workflow_id)
if workflow is None: if workflow is None:
raise WorkflowException(_(u'Requested workflow definition not found.')) raise WorkflowException(_(u'Requested workflow not found.'))
if workflow.getPortalType() == 'Workflow': action_id = workflow.getTransitionIdByReference(action_reference)
action_id = workflow.getTransitionIdByReference(action_reference)
result = workflow.doActionFor(current_object, action_id, **kw) result = workflow.doActionFor(current_object, action_id, **kw)
return result return result
......
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