From b1cb25353be5f635320ad70bf34197030a328979 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Thu, 16 Mar 2017 14:28:05 +0100 Subject: [FIX] web: BasicModel: list count when grouped Before this rev., the count attribute of list dataPoints was basically the length of the data Array. It means that for an ungrouped list, it was the number of records in the list, and for a list containing groups, it was the number of groups. This caused a problem in the list view with nested groups, as the counter in the group header is supposed to display the number of records in the group, whether or not the group contains other subgroups or directly records. This commit changes a bit the semantics of the count attribute, such that it always represents the number of records inside the list (i.e. the sums of records inside subgroups if the list is grouped). --- addons/web/static/src/js/views/basic/basic_model.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src/js/views/basic/basic_model.js') 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 5180cc41656..010cc37d8d6 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -2059,7 +2059,7 @@ var BasicModel = AbstractModel.extend({ return self.localData[groupID]; }); list.data = []; - list.count = groups.length; + list.count = 0; var defs = []; _.each(groups, function (group) { @@ -2086,6 +2086,7 @@ var BasicModel = AbstractModel.extend({ type: 'list', }); list.data.push(newGroup.id); + list.count += newGroup.count; var old_group = _.find(previousGroups, function (g) { return g.res_id === newGroup.res_id && g.value === newGroup.value; }); -- cgit v1.2.3