summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabien Pinckaers <fp@tinyerp.com>2012-09-06 18:17:19 +0200
committerFabien Pinckaers <fp@tinyerp.com>2012-09-06 18:17:19 +0200
commita43f4e1419df54f6ce205b17db293b56629aed77 (patch)
treec94d64106137b8735f4911d189b6f3ca41e4c5f2
parent5c6b8431aac58b22add81b47bca46beeedf55c57 (diff)
[IMP] folded columns in read_group
bzr revid: fp@tinyerp.com-20120906161719-k4r56bgbso6rprtu
-rw-r--r--openerp/osv/orm.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py
index 2ba8afd8e72..7d8bb84fc25 100644
--- a/openerp/osv/orm.py
+++ b/openerp/osv/orm.py
@@ -670,7 +670,7 @@ class BaseModel(object):
_description = None
_needaction = False
- # dict of {field:method}, with method returning the name_get of records
+ # dict of {field:method}, with method returning the (name_get of records, {id: fold})
# to include in the _read_group, if grouped on this field
_group_by_full = {}
@@ -2447,7 +2447,7 @@ class BaseModel(object):
# Grab the list of all groups that should be displayed, including all present groups
present_group_ids = [x[groupby][0] for x in read_group_result if x[groupby]]
- all_groups = self._group_by_full[groupby](self, cr, uid, present_group_ids, domain,
+ all_groups,folded = self._group_by_full[groupby](self, cr, uid, present_group_ids, domain,
read_group_order=read_group_order,
access_rights_uid=openerp.SUPERUSER_ID,
context=context)
@@ -2498,6 +2498,9 @@ class BaseModel(object):
append_left(read_group_result.pop(0))
else:
append_right(all_groups.pop(0))
+ if folded:
+ for r in result:
+ r['__fold'] = folded.get(r[groupby], False)
return result
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False):