From ac8d83cc124a6175a263e11795fda35eebe69324 Mon Sep 17 00:00:00 2001 From: "Arthur Detroux (ard)" Date: Fri, 8 Oct 2021 14:09:45 +0000 Subject: [PATCH] [FIX] website: properly rerender dynamic snippet Before this commit, changing a filter in the dynamic snippet could cause errors because the option wasn't awaiting an asynchronous call. This commit fixes that by using the same mechanism used in the s_website_form snippet, relegating the rerenderXML call to updateUI task-2654924 closes odoo/odoo#80867 X-original-commit: 8a4391a7d6e6988da7b62f6caa91e49c831da774 Signed-off-by: Quentin Smetz (qsm) --- .../src/snippets/s_dynamic_snippet/options.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/addons/website/static/src/snippets/s_dynamic_snippet/options.js b/addons/website/static/src/snippets/s_dynamic_snippet/options.js index f1f7cde19ff..408d200b4ee 100644 --- a/addons/website/static/src/snippets/s_dynamic_snippet/options.js +++ b/addons/website/static/src/snippets/s_dynamic_snippet/options.js @@ -62,6 +62,20 @@ const dynamicSnippetOptions = options.Class.extend({ // Public //-------------------------------------------------------------------------- + /** + * See from updateUI in s_website_form + * + * @override + */ + async updateUI() { + if (this.rerender) { + this.rerender = false; + await this._rerenderXML(); + return; + } + await this._super(...arguments); + }, + /** * @override */ @@ -252,7 +266,7 @@ const dynamicSnippetOptions = options.Class.extend({ _filterUpdated: function (filter) { if (filter && this.currentModelName !== filter.model_name) { this.currentModelName = filter.model_name; - this._rerenderXML(); + this.rerender = true; } }, /**