Commit 57cc2a7b authored by Tomáš Peterka's avatar Tomáš Peterka

[erp5_core] Mass Workflow Transition does not fail with only one possible transition

parent 710e975a
...@@ -290,6 +290,52 @@ ...@@ -290,6 +290,52 @@
<tr><td>select</td> <tr><td>select</td>
<td>//select[@name="field_workflow_action"]</td> <td>//select[@name="field_workflow_action"]</td>
<td>value=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" />
</tal:block>
<tr><td>waitForElementPresent</td>
<td>//textarea[@name="field_workflow_dialog_your_comment"]</td><td></td></tr>
<tr><td>type</td>
<td>//textarea[@name="field_workflow_dialog_your_comment"]</td>
<td>Pain perdu</td></tr>
<tr><td>pause</td><td>2000</td><td></td></tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tal:block tal:define="notification_configuration python: {'class': 'success', 'text': 'Workflow modification in progress.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tr><td>open</td>
<td>${base_url}/Zuite_waitForActivities</td><td></td></tr>
<tr><td>assertTextPresent</td>
<td>Done.</td><td></td></tr>
<tr><td>open</td>
<td>${renderjs_url}/#/foo_module</td><td></td></tr>
<tal:block tal:define="pagination_configuration python: {'header': '(1 - 3 / 6)', 'footer': 'Records 1 - 3 / 6'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/check_listbox_pagination_text" />
</tal:block>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="field_listbox"]//tbody/tr[1]/td[1]//a</td><td></td></tr>
<tr><td>click</td>
<td>//div[@data-gadget-scope="field_listbox"]//tbody/tr[1]/td[1]//a</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-role="header"]//a[@data-i18n="Views"]</td><td></td></tr>
<tr><td>click</td>
<td>//div[@data-role="header"]//a[@data-i18n="Views"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@role="main"]//ul[@data-role="listview"]//a[@data-i18n="History"]</td><td></td></tr>
<tr><td>click</td>
<td>//div[@role="main"]//ul[@data-role="listview"]//a[@data-i18n="History"]</td><td></td></tr>
<tr><td>waitForTextPresent</td>
<td>Pain perdu</td><td></td></tr>
<tr><td>assertTextPresent</td>
<td>Pain perdu</td><td></td></tr>
</tbody></table> </tbody></table>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -33,9 +33,5 @@ for result in result_list: ...@@ -33,9 +33,5 @@ for result in result_list:
if workflow_action == action['id']: if workflow_action == action['id']:
return action_form_id # early return for performance reasons return action_form_id # early return for performance reasons
if not workflow_action and len(id_form_dict) == 1:
# if we have only one possible workflow transition we suppose it is the default one
return id_form_dict.items()[0][1]
# if we have no idea what workflow form we should use - just use ~~the default one~~ nothing # if we have no idea what workflow form we should use - just use ~~the default one~~ nothing
return "" return ""
...@@ -40,9 +40,6 @@ for result in context.Base_searchUsingFormIdAndQuery(form_id, query, limit=50): ...@@ -40,9 +40,6 @@ for result in context.Base_searchUsingFormIdAndQuery(form_id, query, limit=50):
if not transition_dict: if not transition_dict:
workflow_list.append((translate("No state change possible"), "")) workflow_list.append((translate("No state change possible"), ""))
if len(transition_dict) == 1:
workflow_list = [] # if there is only one workflow possible - do not bother with an empty option
# transition_dict.items() is in form (id, title) but ERP5 requires (title, id) so we reverse # transition_dict.items() is in form (id, title) but ERP5 requires (title, id) so we reverse
if transition_dict: if transition_dict:
workflow_list.extend((title, id) for id, title in sorted(transition_dict.items(), key=lambda x: x[1])) workflow_list.extend((title, id) for id, title in sorted(transition_dict.items(), key=lambda x: x[1]))
......
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