diff options
| author | Aaron Bohy <aab@odoo.com> | 2017-03-22 13:44:09 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-04-11 19:44:38 +0200 |
| commit | b3015960c1e4dd282d948fb5f56490639d81c343 (patch) | |
| tree | 3483cc7dac040081b97406e9406781de40b3d6b8 /addons/web/static/src/js/views/basic/basic_model.js | |
| parent | 3f8569a05702a8d14f18e8303e2f9418ec65a287 (diff) | |
[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.
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 | 8 |
1 files changed, 5 insertions, 3 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 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 { |
