Commit 2eb06327 authored by wenjie.zheng's avatar wenjie.zheng

WorkflowTool.py: add a separated reassignment function instead of putting this...

WorkflowTool.py: add a separated reassignment function instead of putting this function in conversion function.
parent a02544ec
......@@ -562,20 +562,21 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
self._finalizeWorkflowConversion(dc_workflow)
# override temporary id:
workflow.setId(workflow.default_reference)
workflow_id = workflow.getId()
# type-workflow reassignment
type_workflow_dict = self.getChainsByType()
type_tool = self.getPortalObject().portal_types
for ptype_id in type_workflow_dict:
ptype = type_tool._getOb(ptype_id, None)
if ptype is not None and workflow_id in type_workflow_dict[ptype_id]:
# 1. clean DC workflow assignement:
self.delTypeCBT(ptype_id, workflow_id)
# 2. assign ERP5 Workflow to portal type:
if workflow_id not in ptype.getTypeWorkflowList():
ptype.addTypeWorkflowList(workflow_id)
return workflow
def reassignWorkflow(self, workflow_id):
# type-workflow reassignment
type_workflow_dict = self.getChainsByType()
type_tool = self.getPortalObject().portal_types
for ptype_id in type_workflow_dict:
ptype = type_tool._getOb(ptype_id, None)
if ptype is not None and workflow_id in type_workflow_dict[ptype_id]:
# 1. clean DC workflow assignement:
self.delTypeCBT(ptype_id, workflow_id)
# 2. assign ERP5 Workflow to portal type:
if workflow_id not in ptype.getTypeWorkflowList():
ptype.addTypeWorkflowList(workflow_id)
def getChainDict(self):
chain_dict = {}
for portal_type, wf_id_list in self._chains_by_type.iteritems():
......
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