diff --git a/trytond/trytond/model/modelsql.py b/trytond/trytond/model/modelsql.py index b190f6f7fa2ffc2b8bbc9190834ea4d26c33bc70_dHJ5dG9uZC90cnl0b25kL21vZGVsL21vZGVsc3FsLnB5..c544661300ba3dc53db4378d4070b4aae8c5c32e_dHJ5dG9uZC90cnl0b25kL21vZGVsL21vZGVsc3FsLnB5 100644 --- a/trytond/trytond/model/modelsql.py +++ b/trytond/trytond/model/modelsql.py @@ -1824,12 +1824,15 @@ order_by = cls.__search_order(order, tables) # compute it here because __search_order might modify tables table = convert_from(None, tables) - columns = cls.__searched_columns(main_table, eager=not query) - if backend.name == 'sqlite': - for column in columns: - field = cls._fields.get(column.output_name) - if field: - column.output_name += ' [%s]' % field.sql_type().base + if query: + columns = [main_table.id.as_('id')] + else: + columns = cls.__searched_columns(main_table, eager=True) + if backend.name == 'sqlite': + for column in columns: + field = cls._fields.get(column.output_name) + if field: + column.output_name += ' [%s]' % field.sql_type().base select = table.select( *columns, where=expression, limit=limit, offset=offset, order_by=order_by)