From c6c4b9f0e4bae03b51d232ea920de9587d8e2b73 Mon Sep 17 00:00:00 2001 From: Romeo Fragomeli Date: Thu, 8 Oct 2020 08:20:25 +0000 Subject: [FIX] web: don't update the list view if not needed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, an event was triggered even when no change occurred. Steps to reproduces: * Go to Document * Change to list view * Go to app switcher * Select another app that has enough content to be able to scroll * Scroll the view => Bug Task ID: 2347584 closes odoo/odoo#63012 Signed-off-by: Adrien Dieudonné (adr) Co-authored-by: Michaël Mattiello --- addons/web/static/src/js/views/list/list_renderer.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src/js/views') diff --git a/addons/web/static/src/js/views/list/list_renderer.js b/addons/web/static/src/js/views/list/list_renderer.js index 4571b1275a4..7559fda1063 100644 --- a/addons/web/static/src/js/views/list/list_renderer.js +++ b/addons/web/static/src/js/views/list/list_renderer.js @@ -1168,6 +1168,7 @@ var ListRenderer = BasicRenderer.extend({ * @private */ _updateSelection: function () { + const previousSelection = JSON.stringify(this.selection); this.selection = []; var self = this; var $inputs = this.$('tbody .o_list_record_selector input:visible:not(:disabled)'); @@ -1180,7 +1181,9 @@ var ListRenderer = BasicRenderer.extend({ } }); this.$('thead .o_list_record_selector input').prop('checked', allChecked); - this.trigger_up('selection_changed', { allChecked, selection: this.selection }); + if (JSON.stringify(this.selection) !== previousSelection) { + this.trigger_up('selection_changed', { allChecked, selection: this.selection }); + } this._updateFooter(); }, -- cgit v1.2.3