[FIX] Server side sorting for _inherits relations corrected

bzr revid: jvo@tinyerp.com-20100825190431-bh3fxeu044sv8xaj
This commit is contained in:
Jay (OpenERP)
2010-08-26 00:34:31 +05:30
parent 0125777a07
commit e3296e894b
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -71,7 +71,7 @@ class expression(object):
raise ValueError('Bad domain expression: %r' % (exp,))
self.__exp = exp
self.__field_tables = {} # used to store the table to use for the sql generation. key = index of the leaf
self.__all_tables = set()
self.__all_tables = []
self.__joins = []
self.__main_table = None # 'root' table. set by parse()
self.__DUMMY_LEAF = (1, '=', 1) # a dummy leaf that must not be parsed or sql generated
@@ -106,7 +106,7 @@ class expression(object):
return [(left, 'in', rg(ids, table, parent or table._parent_name))]
self.__main_table = table
self.__all_tables.add(table)
self.__all_tables.append(table)
i = -1
while i + 1<len(self.__exp):
@@ -129,7 +129,7 @@ class expression(object):
working_table = main_table.pool.get(main_table._inherit_fields[fargs[0]][0])
if working_table not in self.__all_tables:
self.__joins.append('%s.%s=%s.%s' % (working_table._table, 'id', main_table._table, main_table._inherits[working_table._name]))
self.__all_tables.add(working_table)
self.__all_tables.append(working_table)
main_table = working_table
field = working_table._columns.get(fargs[0], False)
+1 -1
View File
@@ -3827,7 +3827,7 @@ class orm(orm_template):
# Allowing inherits'ed field for server side sorting
inherited_tables, inherit_join = self._inherits_join_calc(o, tables, where_clause)
if inherited_tables:
inherited_sort_table = inherited_tables[0]
inherited_sort_table = inherited_tables[-1]
order_by = inherited_sort_table + '.' + order
limit_str = limit and ' limit %d' % limit or ''