summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/list
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2020-09-03 07:20:20 +0000
committerAaron Bohy <aab@odoo.com>2020-09-04 13:14:46 +0000
commita5ab687be4e7890262ce9429e18dd011021513d5 (patch)
tree98ef2192847f8b59adf6063b2f962a1cddac187c /addons/web/static/src/js/views/list
parent96a8a4aad70c6ff1c53a7f4919fc1aad3039f5ab (diff)
[FIX] web: list: do not call on_attach_callback at reload
Before this commit, the ListRenderer's on_attach_callback hook was called each time the view was reloaded, even though the renderer was already in the DOM. As a consequence, sub components were mounted several times, which could lead to issues. For instance, go to Inventory > Operations > Transfers, create a new one. Change the Operation Type to a Receipt, and change again to a Delivery: it crashed. Task 2315149 Closes #56701 closes odoo/odoo#57099 X-original-commit: 78f361fb5382e4c7aed9a4e705e20f8d8757300d Signed-off-by: Julien Mougenot (jum) <jum@odoo.com> Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/views/list')
-rw-r--r--addons/web/static/src/js/views/list/list_renderer.js8
1 files changed, 4 insertions, 4 deletions
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 05481cd9556..4571b1275a4 100644
--- a/addons/web/static/src/js/views/list/list_renderer.js
+++ b/addons/web/static/src/js/views/list/list_renderer.js
@@ -1090,10 +1090,10 @@ var ListRenderer = BasicRenderer.extend({
// append the table (if any) to the main element
if (tableWrapper) {
- dom.append(this.el, tableWrapper, {
- callbacks: [{ widget: this }],
- in_DOM: document.body.contains(this.el),
- });
+ this.el.appendChild(tableWrapper);
+ if (document.body.contains(this.el)) {
+ this.pagers.forEach(pager => pager.on_attach_callback());
+ }
if (this.optionalColumns.length) {
this.el.classList.add('o_list_optional_columns');
this.$('table').append(