Fix order for selection fields that use a function instead of list.

This commit is contained in:
Cédric Krier committed 2009-01-13 14:07:21 +01:00
1 parent 73a256f5b4
commit 77b667f647
1 file changed
+4
+4
View File
@@ -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