From 953fb092636b9919aaa6c6a6cfaffd003ba951d5 Mon Sep 17 00:00:00 2001 From: Julien Mougenot Date: Tue, 22 Dec 2020 16:59:46 +0000 Subject: [FIX] web,mail: Call on_attach_callback when appending content Before this commit, the form renderer would call "on_attach_callback" only when the whole _render process was over. The problem was that this process is asynchronous and this callback should be invoked as soon as the widgets are appended. As such, any asynchronous operation is performed before appending the content in a new function "__renderView". Task 2346540 closes odoo/odoo#60791 Signed-off-by: Aaron Bohy (aab) --- addons/web/static/src/js/views/basic/basic_renderer.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src/js/views/basic/basic_renderer.js') diff --git a/addons/web/static/src/js/views/basic/basic_renderer.js b/addons/web/static/src/js/views/basic/basic_renderer.js index 16ecc473915..a03b9b41a77 100644 --- a/addons/web/static/src/js/views/basic/basic_renderer.js +++ b/addons/web/static/src/js/views/basic/basic_renderer.js @@ -684,7 +684,7 @@ var BasicRenderer = AbstractRenderer.extend(WidgetAdapterMixin, { if (this._isInDom) { for (const handle in this.allFieldWidgets) { this.allFieldWidgets[handle].forEach(widget => { - if (widget.on_attach_callback) { + if (!utils.isComponent(widget.constructor) && widget.on_attach_callback) { widget.on_attach_callback(); } }); @@ -694,6 +694,8 @@ var BasicRenderer = AbstractRenderer.extend(WidgetAdapterMixin, { widget.on_attach_callback(); } }); + // call on_attach_callback on child components (including field components) + WidgetAdapterMixin.on_attach_callback.call(this); } }, /** -- cgit v1.2.3