Commit f1f061a0 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Fix collateral damages. Take into account uids for filtered selection at the...

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
parent e8262969
# -*- coding: utf-8 -*-
############################################################################# #############################################################################
# #
# Copyright (c) 2007 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2007 Nexedi SA and Contributors. All Rights Reserved.
...@@ -141,6 +142,13 @@ def getDocumentGroupByWorkflowStateList(self, form_id='', **kw): ...@@ -141,6 +142,13 @@ def getDocumentGroupByWorkflowStateList(self, form_id='', **kw):
workflow_state=doc.getProperty(state_var), 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 return document_list
...@@ -163,9 +171,6 @@ def getWorkflowActionDocumentList(self, **kw): ...@@ -163,9 +171,6 @@ def getWorkflowActionDocumentList(self, **kw):
selection_uid_list = selection_tool.getSelectionCheckedUidsFor(selection_name) selection_uid_list = selection_tool.getSelectionCheckedUidsFor(selection_name)
if selection_uid_list:
original_selection_params['uid'] = selection_uid_list
translate = self.Base_translateString translate = self.Base_translateString
for listbox_selection in listbox: for listbox_selection in listbox:
if listbox_selection.get('workflow_action'): if listbox_selection.get('workflow_action'):
...@@ -174,6 +179,8 @@ def getWorkflowActionDocumentList(self, **kw): ...@@ -174,6 +179,8 @@ def getWorkflowActionDocumentList(self, **kw):
selection_params[listbox_selection['state_var']] = \ selection_params[listbox_selection['state_var']] = \
listbox_selection['workflow_state'] listbox_selection['workflow_state']
selection_params['portal_type'] = listbox_selection['portal_type'] 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_id, action = listbox_selection['workflow_action'].split('/')
workflow = wtool.getWorkflowById(workflow_id) workflow = wtool.getWorkflowById(workflow_id)
......
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