summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic
diff options
context:
space:
mode:
authorMartin Geubelle <mge@odoo.com>2019-03-19 15:50:46 +0000
committerMartin Geubelle <mge@odoo.com>2019-03-20 09:06:25 +0000
commit3b9483f170d6280f6e39ad0acd4a39dbcb112f55 (patch)
tree11885049396dff8ec56800c0c17662e5941acab7 /addons/web/static/src/js/views/basic
parent8bb46e8b96ff6b8a634ea9fd066351d6253cfbbf (diff)
[REF] web: correctly reuse read_group old datapoint
Rev. odoo/odoo@5c6a7c9 made a change to reuse an old group datapoint when performing a read_group, instead of restoring *some* properties of the old group (so basically a `_.omit` instead of a `_.pick`). This is a bad idea as some properties were bound to the new datapoint (`evaluateModifiers` for example) so it doesn't make any sense to update the old datapoint with theses properties. closes odoo/odoo#31956 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/views/basic')
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js12
1 files changed, 6 insertions, 6 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 d14b9074d87..e7ce88962ff 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -4255,22 +4255,22 @@ var BasicModel = AbstractModel.extend({
return g.res_id === newGroup.res_id && g.value === newGroup.value;
});
if (oldGroup) {
- // restore the internal state of the group
delete self.localData[newGroup.id];
- var updatedProps = _.omit(newGroup, 'limit', 'isOpen', 'offset', 'id');
+ // restore the internal state of the group
+ var updatedProps = _.pick(oldGroup, 'isOpen', 'offset', 'id');
if (options && options.onlyGroups || oldGroup.isOpen && newGroup.groupedBy.length) {
// If the group is opened and contains subgroups,
// also keep its data to keep internal state of
// sub-groups
// Also keep data if we only reload groups' own data
- delete updatedProps.data;
+ updatedProps.data = oldGroup.data;
}
+ _.extend(newGroup, updatedProps);
// set the limit such that all previously loaded records
// (e.g. if we are coming back to the kanban view from a
// form view) are reloaded
- oldGroup.limit = oldGroup.limit + oldGroup.loadMoreOffset;
- _.extend(oldGroup, updatedProps);
- newGroup = oldGroup;
+ newGroup.limit = oldGroup.limit + oldGroup.loadMoreOffset;
+ self.localData[newGroup.id] = newGroup;
} else if (!newGroup.openGroupByDefault || openGroupCount >= self.OPEN_GROUP_LIMIT) {
newGroup.isOpen = false;
} else {