Commit c9fe4aa8 authored by wenjie.zheng's avatar wenjie.zheng Committed by Sebastien Robin

erp5_workflow: finish the function of reassignment of converted workflow.

parent 5db81783
......@@ -87,21 +87,17 @@ for dc_wf in selected_wf_list:\n
workflow = context.dc_workflow_asERP5Object(context, dc_wf, temp=0)\n
selected_wf_id_list.append(dc_wf.id)\n
\n
"""\n
# reassign workflow to portal types\n
\n
for ptype in context.getPortalObject().portal_types.objectValues():\n
dc_wf_chain = []\n
\n
# 1. clean DC workflow assignement:\n
dc_wf_chain.append(context.getTypeCBT(ptype.id))\n
if dc_workflow_id in dc_wf_chain:\n
context.delTypeCBT(ptype.id, dc_workflow_id)\n
context.delTypeCBT(ptype.id, dc_wf.id)\n
\n
# 2. assign new workflow to the portal_type:\n
# 2. assign ERP5 Workflow to portal type:\n
type_erp5workflow_list = ptype.getTypeERP5WorkflowList()\n
if wf_id not in type_erp5workflow_list:\n
type_erp5workflow_list.append(wf_id)\n
if workflow.getId() not in type_erp5workflow_list:\n
type_erp5workflow_list.append(workflow.getId())\n
ptype.edit(type_erp5workflow_list=type_erp5workflow_list)\n
"""\n
\n
return RESPONSE.redirect("%s/view?portal_status_message=Workflow+%s+converted"\n
%(context.absolute_url(), \',+\'.join(selected_wf_id_list)))\n
......
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