From b3015960c1e4dd282d948fb5f56490639d81c343 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Wed, 22 Mar 2017 13:44:09 +0100 Subject: [FIX] web: BasicModel: read_group: empty groups When reloading a grouped Kanban view (e.g. after specifying a new domain), the internal state of the (sub-)groups is kept so that it can be restored (like which are the open groups and the limit and offset inside the groups). However, for models and fields whose read_group returns empty groups (e.g. project.task grouped by stade_id) this was wrong if the specified domain filtered out all records of an open group, because as its data wasn't reloaded (because there is no record), the old data were still in place, so the filtered out records still appeared in the Kanban. --- addons/web/static/src/js/views/basic/basic_model.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (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 0c2bbd4d23e..deb14b8bf83 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -2113,9 +2113,11 @@ var BasicModel = AbstractModel.extend({ if (oldGroup) { // restore the internal state of the group _.extend(newGroup, _.pick(oldGroup, 'limit', 'isOpen', 'offset')); - // if open, also restore the oldGroup data to keep internal - // state of sub-groups - newGroup.data = oldGroup.isOpen ? oldGroup.data : []; + // if the group is open and contains subgroups, also + // restore its data to keep internal state of sub-groups + if (newGroup.isOpen && newGroup.groupedBy.length) { + newGroup.data = oldGroup.data; + } } else if (!newGroup.openGroupByDefault) { newGroup.isOpen = false; } else { -- cgit v1.2.3