Commit ed25a9bf authored by iv's avatar iv

ERP5Workflow: add 'script_' prefix in the script's id when converting it

parent 45794c3c
...@@ -35,7 +35,7 @@ from Products.ERP5Type import Permissions, PropertySheet ...@@ -35,7 +35,7 @@ from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.ConsistencyMessage import ConsistencyMessage from Products.ERP5Type.ConsistencyMessage import ConsistencyMessage
from Products.ERP5Type.id_as_reference import IdAsReferenceMixin from Products.ERP5Type.id_as_reference import IdAsReferenceMixin
class WorkflowScript(PythonScript, IdAsReferenceMixin("", "prefix")): class WorkflowScript(PythonScript, IdAsReferenceMixin("script_", "prefix")):
meta_type = 'ERP5 Python Script' meta_type = 'ERP5 Python Script'
portal_type = 'Workflow Script' portal_type = 'Workflow Script'
add_permission = Permissions.AddPortalContent add_permission = Permissions.AddPortalContent
......
...@@ -263,7 +263,8 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -263,7 +263,8 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
initial_script_name_list = [initial_script_name_list] initial_script_name_list = [initial_script_name_list]
for script_name in initial_script_name_list: for script_name in initial_script_name_list:
if script_name: if script_name:
script = getattr(workflow, 'ScriptPrefix_' + script_name, None) or getattr(workflow, script_name, None) or getattr(workflow, 'transition_' + script_name, None) script = getattr(workflow, 'script_' + script_name, None) or \
getattr(workflow, 'transition_' + script_name, None)
script_path = script.getRelativeUrl() script_path = script.getRelativeUrl()
script_path_list.append(script_path) script_path_list.append(script_path)
method(tuple(script_path_list)) method(tuple(script_path_list))
...@@ -303,10 +304,9 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -303,10 +304,9 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
for script_id in dc_workflow_script_list: for script_id in dc_workflow_script_list:
script = dc_workflow_script_list.get(script_id) script = dc_workflow_script_list.get(script_id)
# add a prefix if there is a script & method conflict # add a prefix if there is a script & method conflict
if hasattr(workflow, script_id): workflow_script = workflow.newContent(id='script_' + script_id,
workflow_script = workflow.newContent(id='ScriptPrefix_'+script_id, portal_type='Workflow Script', temp_object=is_temporary) portal_type='Workflow Script',
else: temp_object=is_temporary)
workflow_script = workflow.newContent(id=script_id, portal_type='Workflow Script', temp_object=is_temporary)
workflow_script.setTitle(script.title) workflow_script.setTitle(script.title)
workflow_script.default_reference = script_id workflow_script.default_reference = script_id
workflow_script.setParameterSignature(script._params) workflow_script.setParameterSignature(script._params)
......
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