From 44b662b5bb799f46ee9ce948de26b6e06cea8e6e Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 6 Aug 2012 10:08:46 +0200 Subject: [PATCH] [IMP] merge group count into group title in grouped list, as requested by al bzr revid: xmo@openerp.com-20120806080846-w4r7t84gbpf9o47o --- addons/web/static/src/js/view_list.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index e1367fb792a..57be3ca6db1 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -444,10 +444,6 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi id: '_group', tag: '', string: _t("Group"), meta: true, modifiers_for: function () { return {}; }, modifiers: {} - }, { - id: '_count', tag: '', string: '#', meta: true, - modifiers_for: function () { return {}; }, - modifiers: {} }); } @@ -1342,15 +1338,19 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we _t("Grouping on field '%s' is not possible because that field does not appear in the list view."), group.grouped_on)); } + var group_label; try { - $group_column.html(instance.web.format_cell( + group_label = instance.web.format_cell( row_data, group_column, { value_if_empty: _t("Undefined"), process_modifiers: false - })); + }); } catch (e) { - $group_column.html(row_data[group_column.id].value); + group_label = row_data[group_column.id].value; } + $group_column.text(_.str.sprintf("%s (%d)", + group_label, group.length)); + if (group.length && group.openable) { // Make openable if not terminal group & group_by_no_leaf $group_column.prepend(''); @@ -1362,8 +1362,6 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we } } self.indent($group_column, group.level); - // count column - $('').text(group.length).appendTo($row); if (self.options.selectable) { $row.append('');