From a99d656d134bc527dd57cf81a02866a2fb8abf10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Fri, 24 Jul 2015 12:16:10 +0200 Subject: [PATCH] [FIX] web_kanban: better behaviour when grouping * fix a crash when grouping on non-many2one fields (due to the group.values object being not initialized) * display correct label when grouping on selection fields We should have a better way to deal with fields differences. There is this weird concept called "abstraction", which could be applied and would allow everyone to focus on their business and not on dealing with this, but that would probably not fit with our codebase. --- addons/web_kanban/static/src/js/kanban_view.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/web_kanban/static/src/js/kanban_view.js b/addons/web_kanban/static/src/js/kanban_view.js index bb697a3a131..5b8ad3af8e6 100644 --- a/addons/web_kanban/static/src/js/kanban_view.js +++ b/addons/web_kanban/static/src/js/kanban_view.js @@ -214,7 +214,12 @@ var KanbanView = View.extend({ } else { _.each(groups, function (group) { var value = group.attributes.value; + var field = self.fields_view.fields[self.group_by_field]; + if (field && field.type === "selection") { + value= _.find(field.selection, function (s) { return s[0] === group.attributes.value; }); + } group.title = (value instanceof Array ? value[1] : value) || _t("Undefined"); + group.values = {}; }); return $.when(groups); }