[FIX] read_group: better support for empty 'fields' or 'groupby' parameters

lp bug: https://launchpad.net/bugs/692259 fixed

bzr revid: odo@openerp.com-20101221143714-nvvmg2zmbkowbx60
This commit is contained in:
Olivier Dony 2010-12-21 15:37:14 +01:00
parent 49bd4d1aba
commit 1ba2ff569f
1 changed files with 1 additions and 1 deletions

View File

@ -2318,7 +2318,7 @@ class orm(orm_template):
offset_str = offset and ' offset %d' % offset or ''
if len(groupby_list) < 2 and context.get('group_by_no_leaf'):
group_count = '_'
cr.execute('SELECT min(%s.id) AS id, count(%s.id) AS %s_count, ' % (self._table, self._table, group_count) + flist + ' FROM ' + from_clause + where_clause + gb + limit_str + offset_str, where_clause_params)
cr.execute('SELECT min(%s.id) AS id, count(%s.id) AS %s_count' % (self._table, self._table, group_count) + (flist and ',') + flist + ' FROM ' + from_clause + where_clause + gb + limit_str + offset_str, where_clause_params)
alldata = {}
groupby = group_by
for r in cr.dictfetchall():