[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.
This commit is contained in:
Géry Debongnie
2015-07-24 12:17:26 +02:00
parent 2350d1f3ba
commit a99d656d13
@@ -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);
}