This page describes the rules to make action dialogs.
Your action should use object_action category, and have an action name in English.
- The action must use an intermediate dialog, where the user can enter parameters.
This dialog must comply to naming conventions, for example Document_viewDoThisActionDialog.
This form must use form_dialog page template. Fields inside this dialog must use your_ prefix (except listbox).
- It is allowed to use required fields in dialog.
- The title of this dialog must be the same as the action name, it's what will be shown on the button and on the browser title bar.
The action script must be named something like Document_doThisAction. It's usually a python script. This script must redirect to the selected tab, by accepting form_id parameter, it should use Base_redirect utility script to redirect and keep all required request parameters. When redirecting, a portal_status_message must be passed, this will be the status message for the next page. This message must be in English, ending with a period and using spaces to separate words (some old scripts might still be using "%20" or "+", this is obsolete). It's this script responsibility to translate the message before redirecting. Here's an example of such a script, setting the description of the context document from a "user_value", that would be your_user_value field in Document_viewDoThisActionDialog.
1 ## Script (Python) "Document_doThisAction" 2 ##parameters=form_id='view', user_value 3 ## 4 from Products.ERP5Type.Message import translateString 5 6 context.setDescription(user_value) 7 8 return context.Base_redirect(form_id, keep_items=dict( 9 portal_status_message=translateString('Action done.')))
Important note: you may find that using field_your_user_value instead of user_value looks working, but this is a mistake. field_your_user_value is the raw value, whereas user_value is the value after validation by the form. For example, in the case of float fields user_value will be converted to float, field_your_user_value will just be a string.
- The dialog can also have a "Update action". This action is used when you have to update some fields values from the values of other fields.
Note: Design discussion has to be merged there