Commit 67dfdd03 authored by Tomáš Peterka's avatar Tomáš Peterka

[erp5_core] Pass correct values to actual workflow transition

parent 670e58b1
......@@ -8,6 +8,7 @@ This script is intended as a dialog target.
:param comment: {str} optional comment
"""
from Products.CMFCore.WorkflowCore import WorkflowException
from Products.Formulator.Errors import FormValidationError, ValidationError
def stripMyYour(key):
if key.startswith("your_") or key.startswith("my_"):
......@@ -74,10 +75,17 @@ tag = 'folder_workflow_action_{:d}'.format(random.randint(0, 1000)) # Kato: how
priority = 3
batch_size = 100
workflow_action_kwargs = {}
if workflow_dialog is None:
workflow_dialog_id = context.Base_getFormIdForWorkflowAction(form_id, '', workflow_action, uids=uids)
workflow_dialog = getattr(context, workflow_dialog_id)
workflow_action_kwargs = workflow_dialog.validate_all(request, key_prefix='field_workflow_dialog')
try:
workflow_action_kwargs = workflow_dialog.validate_all(request, key_prefix='field_workflow_dialog')
except FormValidationError, ValidationError:
workflow_action_kwargs["comment"] = (comment or
kwargs.get("field_workflow_dialog_your_comment", "") or
kwargs.get("field_workflow_dialog_my_comment", "") or
kwargs.get("field_workflow_dialog_comment", ""))
workflow_action_kwargs = {stripMyYour(key): value for key, value in workflow_action_kwargs.items()}
workflow_action_kwargs['workflow_action'] = workflow_action
......
......@@ -75,10 +75,10 @@
<value>
<list>
<string>workflow_action</string>
<string>workflow_dialog</string>
<string>workflow_dialog_my_workflow_action</string>
<string>workflow_dialog_your_workflow_action</string>
<string>workflow_action_rendered</string>
<string>workflow_dialog</string>
</list>
</value>
</item>
......
......@@ -193,7 +193,7 @@
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
<value> <string>my_workflow_action</string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
......@@ -201,7 +201,7 @@
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
<value> <string>non-existing-dummy</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -249,7 +249,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>workflow_dialog_my_action</string> </value>
<value> <string>workflow_dialog_my_workflow_action</string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
......
......@@ -193,7 +193,7 @@
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
<value> <string>your_workflow_action</string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
......@@ -201,7 +201,7 @@
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
<value> <string>non-existing-dummy</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -249,7 +249,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>workflow_dialog_my_workflow_action</string> </value>
<value> <string>workflow_dialog_your_workflow_action</string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
......
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