summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRavi Gohil <rgo@odoo.com>2018-09-14 16:32:22 +0530
committerRomainLibert <rli@odoo.com>2018-09-14 15:43:10 +0200
commit5c11e0d6f9dcc2161735ce3fb93430b767d54cf9 (patch)
tree74ae6a241ca1b9498f3024dc78be86a3b0a751e9
parent2b9d5f929c479b0fa85207821a461fb2b5e6e241 (diff)
[FIX] models: support group by with multiple date fields
When filling the results of a read_group using _read_group_fill_temporal we were using the name of the field. (https://github.com/odoo/odoo/commit/283c842289f1bc06bc30a877864e868127418e80) But _read_group_format_result needs the name of the groupy which can differ from the name of the field as groupby supports the following syntax for dates `field:groupby` This ultimately lead to a crash when trying to groupby multiple date fields in a graph view. Linked to Tasks : #1879604 and #1879168
-rw-r--r--odoo/models.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/odoo/models.py b/odoo/models.py
index 1187e9eff33..47efe47d164 100644
--- a/odoo/models.py
+++ b/odoo/models.py
@@ -1817,7 +1817,7 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
empty_item = {'id': False, (groupby_name.split(':')[0] + '_count'): 0}
empty_item.update({key: False for key in aggregated_fields})
- empty_item.update({key: False for key in [group['field'] for group in annotated_groupbys[1:]]})
+ empty_item.update({key: False for key in [group['groupby'] for group in annotated_groupbys[1:]]})
grouped_data = collections.defaultdict(list)
for d in data: