From 77b667f647cf18851297f09ebd51f124ddbee6f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 13 Jan 2009 14:07:21 +0100 Subject: [PATCH] Fix order for selection fields that use a function instead of list. --- trytond/osv/orm.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/trytond/osv/orm.py b/trytond/osv/orm.py index 9baade2d2f..819b24d447 100644 --- a/trytond/osv/orm.py +++ b/trytond/osv/orm.py @@ -2984,6 +2984,10 @@ class ORM(object): and self._columns[field_name]._type == 'selection': selections = self.fields_get(cursor, user, [field_name], context=context)[field_name]['selection'] + if not isinstance(selections, (tuple, list)): + selections = getattr(self, + self._columns[field_name].selection)(cursor, + user, context=context) order = 'CASE ' + table_name + '.' + field_name for selection in selections: order += ' WHEN \'%s\' THEN \'%s\'' % selection