Commit 86985db3 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ERP5Workflow: Fix erp5_web_renderjs_ui_test:testFunctionalRJSCore failure.

parent 01fd0f88
......@@ -57,9 +57,9 @@
<tr><td>waitForElementPresent</td>
<td>//select[@name="field_your_mass_workflow_action"]/option</td><td></td></tr>
<tr><td>assertElementPresent</td>
<td>//select[@name="field_your_mass_workflow_action"]/option[@value="transition_validate_action"]</td><td></td></tr>
<td>//select[@name="field_your_mass_workflow_action"]/option[@value="validate_action"]</td><td></td></tr>
<tr><td>assertElementPresent</td>
<td>//select[@name="field_your_mass_workflow_action"]/option[@value="transition_invalidate_action"]</td><td></td></tr>
<td>//select[@name="field_your_mass_workflow_action"]/option[@value="invalidate_action"]</td><td></td></tr>
<tr><th colspan="3">Search <em>( title: "Title 1%" OR title: "Title 3%" )</em> so we work on subset</th></tr>
<tr><td>click</td>
......@@ -77,10 +77,10 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr><td>waitForElementPresent</td>
<td>//select[@name="field_your_mass_workflow_action"]/option[@value="transition_validate_action"]</td><td></td></tr>
<td>//select[@name="field_your_mass_workflow_action"]/option[@value="validate_action"]</td><td></td></tr>
<tr><td>select</td>
<td>//select[@name="field_your_mass_workflow_action"]</td>
<td>value=transition_validate_action</td></tr>
<td>value=validate_action</td></tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="notification_configuration python: {'class': 'error', 'text': 'Form updated.'}">
......@@ -157,10 +157,10 @@
<tr><td>waitForElementPresent</td>
<td>//select[@name="field_your_mass_workflow_action"]/option[@value="transition_invalidate_action"]</td><td></td></tr>
<td>//select[@name="field_your_mass_workflow_action"]/option[@value="invalidate_action"]</td><td></td></tr>
<tr><td>select</td>
<td>//select[@name="field_your_mass_workflow_action"]</td>
<td>value=transition_invalidate_action</td></tr>
<td>value=invalidate_action</td></tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tal:block tal:define="notification_configuration python: {'class': 'error', 'text': 'Form updated.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
......@@ -175,10 +175,10 @@
<tr><td>waitForElementPresent</td>
<td>//select[@name="field_your_mass_workflow_action"]/option[@value="transition_validate_action"]</td><td></td></tr>
<td>//select[@name="field_your_mass_workflow_action"]/option[@value="validate_action"]</td><td></td></tr>
<tr><td>select</td>
<td>//select[@name="field_your_mass_workflow_action"]</td>
<td>value=transition_validate_action</td></tr>
<td>value=validate_action</td></tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tal:block tal:define="notification_configuration python: {'class': 'error', 'text': 'Form updated.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
......
......@@ -21,37 +21,38 @@ checked_workflow_id_dict = {}
for document_portal_type_id in module_portal_type.getTypeAllowedContentTypeList():
if (filter_portal_type_list is not None) and (document_portal_type_id not in filter_portal_type_list):
continue
for workflow in workflow_tool.getWorkflowsFor(document_portal_type_id):
if workflow.id not in checked_workflow_id_dict:
for workflow in workflow_tool.getWorkflowValueListFor(document_portal_type_id):
workflow_id = workflow.getId()
if workflow_id not in checked_workflow_id_dict:
# Do not check the same workflow twice
checked_workflow_id_dict[workflow.id] = None
checked_workflow_id_dict[workflow_id] = None
state_variable = workflow.state_var
state_variable = workflow.getStateVariable()
allowed_state_dict = {}
if getattr(workflow, 'states', None) is not None:
for state_id, state in workflow.states.items():
for possible_transition_id in state.transitions:
if possible_transition_id in allowed_state_dict:
allowed_state_dict[possible_transition_id].append(state_id)
state_value_list = workflow.getStateValueList()
if state_value_list:
for state in state_value_list:
state_reference = state.getReference()
for possible_transition in state.getDestinationValueList():
if possible_transition in allowed_state_dict:
allowed_state_dict[possible_transition].append(state_reference)
else:
allowed_state_dict[possible_transition_id] = [state_id]
for transition_id in allowed_state_dict:
transition = workflow.transitions.get(transition_id, None)
if transition is None:
continue
allowed_state_dict[possible_transition] = [state_reference]
for transition in allowed_state_dict:
transition_reference = transition.getReference()
# Only display user action transition with a dialog to show to user
if (transition.trigger_type == TRIGGER_USER_ACTION) and (transition.actbox_url) and (transition.actbox_name):
action_form_id = transition.actbox_url.rsplit('/', 1)[1].split('?')[0]
if transition.getTriggerType() == TRIGGER_USER_ACTION and transition.getAction() and transition.getActionName():
action_form_id = transition.getAction().rsplit('/', 1)[1].split('?')[0]
result['transition_item_list'].append((translate(transition.actbox_name), transition_id))
result['form_id_dict'][transition_id] = action_form_id
result['transition_item_list'].append((translate(transition.getActionName()), transition_reference))
result['form_id_dict'][transition_reference] = action_form_id
# XXX portal_type parameter must also probably be added too
# This would required to detect identical transition id for different workflow
result['listbox_parameter_dict'][transition_id] = [(state_variable, allowed_state_dict[transition_id])]
elif (transition.trigger_type == TRIGGER_USER_ACTION) and (transition_id == 'delete_action'):
result['listbox_parameter_dict'][transition_id] = [(state_variable, allowed_state_dict[transition_id])]
result['listbox_parameter_dict'][transition_reference] = [(state_variable, allowed_state_dict[transition])]
elif transition.getTriggerType() == TRIGGER_USER_ACTION and transition_reference == 'delete_action':
result['listbox_parameter_dict'][transition_reference] = [(state_variable, allowed_state_dict[transition])]
result['transition_item_list'].sort()
result['transition_item_list'].insert(0, ('', ''))
......
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