Commit 14517d93 authored by iv's avatar iv

ERP5Workflow: add variable to avoid multiple call to function and remove...

ERP5Workflow: add variable to avoid multiple call to function and remove successive 'if/continue' for readability
parent e1c6bea4
......@@ -32,21 +32,17 @@ for portal_type in portal_type:
workflow_set.add(workflow_id)
workflow = workflow_tool[workflow_id]
state_value_dict = workflow.getStateValueDict()
# skip interaction workflows or workflows with only one state (such as edit_workflow)
if workflow.getStateValueDict() is None or len(workflow.getStateIdList()) <= 1:
continue
# skip workflows using another state variable
if state_var not in (None, workflow.getStateVariable()):
continue
for state_id in workflow.getStateValueDict():
state = workflow.getStateValueDict().get(state_id)
if state_id in state_set:
continue
state_set.add(state_id)
result_list.append((str(translateString(state.title)), state_id))
# skip interaction workflows
# or workflows with only one state (such as edit_workflow)
# or workflows using another state variable
if (state_value_dict is not None
and len(workflow.getStateIdList()) > 1
and state_var in (None, workflow.getStateVariable()):
for state in state_value_dict.values():
if not state_id in state_set:
state_set.add(state_id)
result_list.append((str(translateString(state.title)), state_id))
return result_list
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