[FIX] base: traceback in read_group
An issue originally occurs in the Event module. - Go to Events >> Reports >> Events - Add a "Group By" in the search view: "Event Month" - A mighty traceback pops up This is because the rows and the columns are grouped by the same field (`event_date:month`). In method `_read_group_format_result`, a group_by of type "date" or "datetime" is replaced by a "(range_start/range_end, label)" tuple. The first element of the loop on `annotated_groupbys` is handled correctly, but the next identical element will crash on `value + gb['interval']`, since `value` is now a tuple and not a date/datetime anymore. opw-686242
This commit is contained in:
+2
-2
@@ -2209,7 +2209,7 @@ class BaseModel(object):
|
||||
context = context
|
||||
result = self._read_group_raw(cr, uid, domain, fields, groupby, offset=offset, limit=limit, context=context, orderby=orderby, lazy=lazy)
|
||||
|
||||
groupby = [groupby] if isinstance(groupby, basestring) else groupby
|
||||
groupby = [groupby] if isinstance(groupby, basestring) else list(OrderedSet(groupby))
|
||||
dt = [
|
||||
f for f in groupby
|
||||
if self._fields[f.split(':')[0]].type in ('date', 'datetime')
|
||||
@@ -2234,7 +2234,7 @@ class BaseModel(object):
|
||||
query = self._where_calc(cr, uid, domain, context=context)
|
||||
fields = fields or self._columns.keys()
|
||||
|
||||
groupby = [groupby] if isinstance(groupby, basestring) else groupby
|
||||
groupby = [groupby] if isinstance(groupby, basestring) else list(OrderedSet(groupby))
|
||||
groupby_list = groupby[:1] if lazy else groupby
|
||||
annotated_groupbys = [
|
||||
self._read_group_process_groupby(cr, uid, gb, query, context=context)
|
||||
|
||||
Reference in New Issue
Block a user