diff options
| author | Aaron Bohy <aab@odoo.com> | 2017-03-16 14:28:05 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-04-11 19:44:38 +0200 |
| commit | b1cb25353be5f635320ad70bf34197030a328979 (patch) | |
| tree | 669c05056b3d8da4d1435c2c1fd12e70ad67eb6c /addons/web/static/src/js/views/basic/basic_model.js | |
| parent | 322b850ab6ed1d91a7ac44e4eef9ec3e8b02e26a (diff) | |
[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).
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 | 3 |
1 files changed, 2 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 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; }); |
