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

patches/WorkflowTool.py: remove erp5 prefix.

parent d3342c62
...@@ -402,19 +402,13 @@ WorkflowTool._bootstrap = WorkflowTool_bootstrap ...@@ -402,19 +402,13 @@ WorkflowTool._bootstrap = WorkflowTool_bootstrap
def WorkflowTool_listActions(self, info=None, object=None, src__=False): def WorkflowTool_listActions(self, info=None, object=None, src__=False):
""" """
Returns a list of actions to be displayed to the user. Returns a list of actions to be displayed to the user.
o Invoked by the portal_actions tool. o Invoked by the portal_actions tool.
o Allows workflows to include actions to be displayed in the o Allows workflows to include actions to be displayed in the
actions box. actions box.
o Object actions are supplied by workflows that apply to the object. o Object actions are supplied by workflows that apply to the object.
o Global actions are supplied by all workflows. o Global actions are supplied by all workflows.
This patch attemps to make listGlobalActions aware of worklists, This patch attemps to make listGlobalActions aware of worklists,
which allows factorizing them into one single SQL query. which allows factorizing them into one single SQL query.
Related keys are supported. Related keys are supported.
Warning: the worklist cache does not support them. Warning: the worklist cache does not support them.
""" """
...@@ -430,20 +424,20 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False): ...@@ -430,20 +424,20 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False):
if document is not None: if document is not None:
document_pt = document.getTypeInfo() document_pt = document.getTypeInfo()
if document_pt is not None: if document_pt is not None:
workflow_list = document_pt.getTypeERP5WorkflowList() workflow_list = document_pt.getTypeWorkflowList()
if (workflow_list is not None) and (workflow_list is not []): if (workflow_list is not None) and (workflow_list is not []):
for wf_id in workflow_list: for wf_id in workflow_list:
did[wf_id] = None did[wf_id] = None
wf = self.getPortalObject().getDefaultModule('Workflow')._getOb(wf_id, None) wf = self.getPortalObject().portal_workflow._getOb(wf_id, None)
if wf is None: if wf is None:
raise NotImplementedError ("Can not find workflow: %s, please check if the workflow exists."%wf_id) raise NotImplementedError ("Can not find workflow: %s, please check if the workflow exists."%wf_id)
a = wf.listObjectActions(info) a = wf.listObjectActions(info)
if a is not None: if a is not None and a != []:
actions.extend(a) actions.extend(a)
a = wf.getWorklistVariableMatchDict(info) a = wf.getWorklistVariableMatchDict(info)
if a is not None: if a is not None:
worklist_dict[wf_id] = a worklist_dict[wf_id] = a
# DC workflow compatibility
for wf_id in chain: for wf_id in chain:
did[wf_id] = None did[wf_id] = None
wf = self.getWorkflowById(wf_id) wf = self.getWorkflowById(wf_id)
...@@ -508,6 +502,7 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False): ...@@ -508,6 +502,7 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False):
worklist_result_dict = {} worklist_result_dict = {}
# Get a list of dict of WorklistVariableMatchDict grouped by compatible # Get a list of dict of WorklistVariableMatchDict grouped by compatible
# conditions # conditions
(worklist_list_grouped_by_condition, worklist_metadata) = \ (worklist_list_grouped_by_condition, worklist_metadata) = \
groupWorklistListByCondition( groupWorklistListByCondition(
worklist_dict=worklist_dict, worklist_dict=worklist_dict,
...@@ -576,6 +571,7 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False): ...@@ -576,6 +571,7 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False):
key=lambda x: '/'.join((x['workflow_id'], x['worklist_id'])), key=lambda x: '/'.join((x['workflow_id'], x['worklist_id'])),
) )
return action_list return action_list
user = str(_getAuthenticatedUser(self)) user = str(_getAuthenticatedUser(self))
if src__: if src__:
actions = _getWorklistActionList() actions = _getWorklistActionList()
...@@ -585,7 +581,6 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False): ...@@ -585,7 +581,6 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False):
cache_factory = 'erp5_ui_short') cache_factory = 'erp5_ui_short')
actions.extend(_getWorklistActionList()) actions.extend(_getWorklistActionList())
return actions return actions
WorkflowTool.listActions = WorkflowTool_listActions WorkflowTool.listActions = WorkflowTool_listActions
def _getWorklistIgnoredSecurityColumnSet(self): def _getWorklistIgnoredSecurityColumnSet(self):
......
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