diff --git a/product/ERP5Type/ERP5Type.py b/product/ERP5Type/ERP5Type.py index 85983e66b999dd69f8cc61bf8009bdb5f4fb2a0c..12d8789088b3eb2800555f2654e43de86da408d9 100644 --- a/product/ERP5Type/ERP5Type.py +++ b/product/ERP5Type/ERP5Type.py @@ -634,6 +634,15 @@ class ERP5TypeInformation( FactoryTypeInformation, , manage_tabs_message=manage_tabs_message ) + def reorderActions(self, REQUEST=None): + """Reorder actions according to their priorities.""" + new_actions = self._cloneActions() + new_actions.sort(lambda x,y: cmp(x.getPriority(), y.getPriority())) + self._actions = tuple( new_actions ) + + if REQUEST is not None: + return self.manage_editActionsForm(REQUEST, + manage_tabs_message='Actions reordered.') InitializeClass( ERP5TypeInformation ) diff --git a/product/ERP5Type/dtml/editToolsActions.dtml b/product/ERP5Type/dtml/editToolsActions.dtml index 571dda86ed9c95cf22e99c3ed854f6333cae4d07..b35b6bfa3b19f66e82ed1cead2c14123f1045a83 100644 --- a/product/ERP5Type/dtml/editToolsActions.dtml +++ b/product/ERP5Type/dtml/editToolsActions.dtml @@ -181,6 +181,7 @@ <td><input type="submit" name="deleteActions:method" value="Delete" /></td> <td><input type="submit" name="moveUpActions:method" value="Move up" /></td> <td><input type="submit" name="moveDownActions:method" value="Move down" /></td> +<td><input type="submit" name="reorderActions:method" value="Reorder actions by priority" /></td> </tr> </table> </div>