From f1f061a09d6ab0b9466201a25aad8cadddf231ca Mon Sep 17 00:00:00 2001 From: Jean-Paul Smets <jp@nexedi.com> Date: Thu, 24 Dec 2009 17:28:30 +0000 Subject: [PATCH] Fix collateral damages. Take into account uids for filtered selection at the level of selection params. Sort results in a canonical way so that results are predicated, tests possible, and user feels better by havin results grouped by workflow and state always in the same order. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31467 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../Folder_getWorkflowActionDocumentList.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/product/ERP5Form/Extensions/Folder_getWorkflowActionDocumentList.py b/product/ERP5Form/Extensions/Folder_getWorkflowActionDocumentList.py index 49b7757de6..18c6db334b 100644 --- a/product/ERP5Form/Extensions/Folder_getWorkflowActionDocumentList.py +++ b/product/ERP5Form/Extensions/Folder_getWorkflowActionDocumentList.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- ############################################################################# # # Copyright (c) 2007 Nexedi SA and Contributors. All Rights Reserved. @@ -141,6 +142,13 @@ def getDocumentGroupByWorkflowStateList(self, form_id='', **kw): workflow_state=doc.getProperty(state_var), )) + # Let us sort this list by translated title of workflow state and workflow + def compareState(a, b): + return cmp((a.workflow_title, a.translated_workflow_state_title), + (b.workflow_title, b.translated_workflow_state_title)) + document_list.sort(compareState) + + # Return result return document_list @@ -163,9 +171,6 @@ def getWorkflowActionDocumentList(self, **kw): selection_uid_list = selection_tool.getSelectionCheckedUidsFor(selection_name) - if selection_uid_list: - original_selection_params['uid'] = selection_uid_list - translate = self.Base_translateString for listbox_selection in listbox: if listbox_selection.get('workflow_action'): @@ -174,6 +179,8 @@ def getWorkflowActionDocumentList(self, **kw): selection_params[listbox_selection['state_var']] = \ listbox_selection['workflow_state'] selection_params['portal_type'] = listbox_selection['portal_type'] + if selection_uid_list: + selection_params['uid'] = selection_uid_list workflow_id, action = listbox_selection['workflow_action'].split('/') workflow = wtool.getWorkflowById(workflow_id) -- 2.30.9