diff options
| author | fwi-odoo <fwi@odoo.com> | 2017-05-03 09:49:10 +0200 |
|---|---|---|
| committer | fwi-odoo <fwi@odoo.com> | 2017-05-03 13:41:13 +0200 |
| commit | 1af7864fdf5ce40deb40763f760a1c107b5ac7da (patch) | |
| tree | f85af63eab864722647483fae104a46b6430901e /addons/web/static/src/js/views/basic/basic_model.js | |
| parent | a53335fdb2fe6e9232bde66f06e9499bece452d4 (diff) | |
[FIX] web: correct column title when kanban grouped
Before this commit, when a kanban view was grouped by a selection field, the
column were named with the raw value of the selection instead of the display
string.
Furthermore, fix the fact that when the column title was 0 or False,
'undefined' was displayed instead.
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_model.js')
| -rw-r--r-- | addons/web/static/src/js/views/basic/basic_model.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js index 36b86cb0098..93c0dd7c40c 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -2470,6 +2470,15 @@ var BasicModel = AbstractModel.extend({ aggregateValues[key] = value; } }); + // When a view is grouped, we need to display the name of each group in + // the 'title'. + var value = group[rawGroupBy]; + if (list.fields[rawGroupBy].type === "selection") { + var choice = _.find(list.fields[rawGroupBy].selection, function (c) { + return c[0] === value; + }); + value = choice[1]; + } var newGroup = self._makeDataPoint({ modelName: list.model, count: group[rawGroupBy + '_count'], @@ -2477,7 +2486,7 @@ var BasicModel = AbstractModel.extend({ context: list.context, fields: list.fields, fieldsInfo: list.fieldsInfo, - value: group[rawGroupBy], + value: value, aggregateValues: aggregateValues, groupedBy: list.groupedBy.slice(1), orderedBy: list.orderedBy, |
