From a03d6dd19bb93f4dc824654bfbffb19ed0d8b10a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 30 Sep 2008 19:49:16 +0200 Subject: [PATCH] Handle sort attribute on Selection field --- tryton/gui/window/view_form/view/form_gtk/selection.py | 3 ++- tryton/gui/window/view_form/view/list_gtk/parser.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/selection.py b/tryton/gui/window/view_form/view/form_gtk/selection.py index daae0836a7..6102366ed6 100644 --- a/tryton/gui/window/view_form/view/form_gtk/selection.py +++ b/tryton/gui/window/view_form/view/form_gtk/selection.py @@ -46,7 +46,8 @@ class Selection(WidgetInterface): except Exception, exception: common.process_exception(exception, self._window) selection = [] - selection.sort(lambda x, y: cmp(x[1], y[1])) + if attrs.get('sort', True): + selection.sort(lambda x, y: cmp(x[1], y[1])) attrs['selection'] = selection self.set_popdown(selection) self.last_key = (None, 0) diff --git a/tryton/gui/window/view_form/view/list_gtk/parser.py b/tryton/gui/window/view_form/view/list_gtk/parser.py index c74aed0463..703ba5c620 100644 --- a/tryton/gui/window/view_form/view/list_gtk/parser.py +++ b/tryton/gui/window/view_form/view/list_gtk/parser.py @@ -628,7 +628,8 @@ class Selection(Char): except Exception, exception: common.process_exception(exception, self.window) selection = [] - selection.sort(lambda x, y: cmp(x[1], y[1])) + if self.attrs.get('sort', True): + selection.sort(lambda x, y: cmp(x[1], y[1])) self.attrs['selection'] = selection self.selection = selection for i in self.selection: