From 6b1beeae18dcc569850473c38ac0a3d91bdaa353 Mon Sep 17 00:00:00 2001 From: "nch@tinyerp.com" <> Date: Fri, 19 Nov 2010 14:13:38 +0100 Subject: [PATCH] [IMP] list : groupby field can be sorted bzr revid: tfr@openerp.com-20101119131338-7zfxqphrd5fv0bxq --- bin/osv/orm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 496d569a29c..42954b53364 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -403,7 +403,7 @@ class orm_template(object): """Override this method to do specific things when a view on the object is opened.""" pass - def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): + def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, orderby=False, context=None): raise NotImplementedError(_('The read_group method is not implemented on this object !')) def _field_create(self, cr, context=None): @@ -2200,7 +2200,7 @@ class orm(orm_template): _protected = ['read', 'write', 'create', 'default_get', 'perm_read', 'unlink', 'fields_get', 'fields_view_get', 'search', 'name_get', 'distinct_field_get', 'name_search', 'copy', 'import_data', 'search_count', 'exists'] __logger = logging.getLogger('orm') __schema = logging.getLogger('orm.schema') - def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): + def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, orderby=False, context=None): """ Get the list of records in list view grouped by the given ``groupby`` fields @@ -2282,7 +2282,7 @@ class orm(orm_template): alldata[r['id']] = r del r['id'] if groupby and fget[groupby]['type'] == 'many2one': - data_ids = self.search(cr, uid, [('id', 'in', alldata.keys())], order=groupby, context=context) + data_ids = self.search(cr, uid, [('id', 'in', alldata.keys())], order=orderby or groupby, context=context) # the IDS of the records that has groupby field value = False or '' # should be added too data_ids += filter(lambda x:x not in data_ids, alldata.keys())