diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index a89074d322d..79616af85b4 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -664,6 +664,10 @@ class BaseModel(object): _sequence = None _description = None + # dict of {field:method}, with method returning the name_get of records + # to include in the _read_group, if grouped on this field + _group_by_full = {} + # Transience _transient = False # True in a TransientModel _transient_max_count = None @@ -2477,6 +2481,24 @@ class BaseModel(object): del alldata[d['id']][groupby] d.update(alldata[d['id']]) del d['id'] + + if groupby and groupby in self._group_by_full: + gids = map(lambda x: x[groupby][0], data) + stages = self._group_by_full[groupby](self, cr, uid, gids, domain, context) + # as both lists are sorted in the same way, we can merge in one pass + pos = 0 + while stages and ((pos