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

erp5_workflow: add conversion form_dialog in portal_workflow to allow convert...

erp5_workflow: add conversion form_dialog in portal_workflow to allow convert selected dc workflows.
parent febfb21d
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
<value> <value>
<list> <list>
<string>my_title</string> <string>my_title</string>
<string>my_state_base_category</string> <string>my_state_variable_name</string>
</list> </list>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.PythonScripts.standard import url_quote\n
\n
REQUEST = container.REQUEST\n
RESPONSE = REQUEST.RESPONSE\n
\n
workflow_list = kw[\'workflow_list\']\n
selected_wf_list = []\n
selected_wf_id_list = []\n
\n
for wf in workflow_list:\n
if wf.get(\'listbox_selected\'):\n
selected_wf_list.append(context.getObjectFromPath(wf.get(\'listbox_key\')))\n
\n
if len(selected_wf_list) == 0:\n
return context.REQUEST.RESPONSE.redirect(\n
\'%s/WorkflowTool_viewWorkflowConversion?\'\n
\'portal_status_message=%s\' % ( context.absolute_url(),\n
url_quote(\'No Workflow Selected.\')))\n
\n
for dc_wf in selected_wf_list:\n
workflow = getattr(context, "workflow_"+dc_wf.id, None)\n
interaction_workflow = getattr(context, "interactionworkflow_"+dc_wf.id, None)\n
if workflow is not None and not workflow.isTempObject():\n
return context.REQUEST.RESPONSE.redirect(\n
\'%s/WorkflowTool_viewWorkflowConversion?\'\n
\'portal_status_message=%s\' % ( context.absolute_url(),\n
url_quote(\'workflow(s) is already exist.\')))\n
if interaction_workflow is not None and not interaction_workflow.isTempObject():\n
return context.REQUEST.RESPONSE.redirect(\n
\'%s/WorkflowTool_viewWorkflowConversion?\'\n
\'portal_status_message=%s\' % ( context.absolute_url(),\n
url_quote(\'workflow(s) is already exist.\')))\n
\n
# conversion\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
for ptype in context.getPortalObject().portal_types.objectValues():\n
dc_wf_chain = []\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
\n
# 2. assign new workflow to the 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
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
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WorkflowTool_convertWorkflow</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -60,7 +60,7 @@ return workflow_list\n ...@@ -60,7 +60,7 @@ return workflow_list\n
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>ERP5WorkflowTool_getWorkflowList</string> </value> <value> <string>WorkflowTool_getWorkflowList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>WorkflowTool_convertWorkflow</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string>multipart/form-data</string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>workflow_list</string>
</list>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WorkflowTool_viewWorkflowConversion</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>WorkflowTool_viewWorkflowConversion</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_dialog</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Convert Selected Workflows</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
</item> </item>
<item> <item>
<key> <string>pt</string> </key> <key> <string>pt</string> </key>
<value> <string>form_list</string> </value> <value> <string>form_view</string> </value>
</item> </item>
<item> <item>
<key> <string>row_length</string> </key> <key> <string>row_length</string> </key>
......
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