From 68d89150b1b8ff81767e65b14031b5efa0aedf4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souk=C3=A9ina=20Bojabza?= Date: Fri, 8 Sep 2023 14:13:16 +0200 Subject: [PATCH] [FIX] website: fix traceback when customizing Google Map API key Since commit [1], which converted the wysiwyg to Owl, trying to customize the Google Map API key causes a traceback. Steps to reproduce: - In edit mode, go to the "Theme" tab. - Click on the Google Map "Custom Key" button. => A traceback appears. It happens because when getting the parent with the `this.getParent()` call, the parent is now a `WysiwygAdapterComponent` component and so, calling the `trigger_up` function on it does not work anymore. This commit triggers the `gmap_api_key_request` event in a way that is compatible with the Owl component. [1]: https://github.com/odoo/odoo/commit/76d4f9811b756f0e57b0a33dbba534c900c7fe15 opw-3489976 closes odoo/odoo#135069 X-original-commit: 355a593fe2dea05a96d0491d684722770533ab7d Signed-off-by: Romain Derie (rde) --- addons/website/static/src/js/editor/snippets.editor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/website/static/src/js/editor/snippets.editor.js b/addons/website/static/src/js/editor/snippets.editor.js index 9ea5ededccf..b0d668cd3bd 100644 --- a/addons/website/static/src/js/editor/snippets.editor.js +++ b/addons/website/static/src/js/editor/snippets.editor.js @@ -97,7 +97,7 @@ const wSnippetMenu = weSnippetEditor.SnippetsMenu.extend({ } const apiKey = await new Promise(resolve => { - this.getParent().trigger_up('gmap_api_key_request', { + this.getParent()._websiteRootEvent("gmap_api_key_request", { onSuccess: key => resolve(key), }); }); @@ -212,7 +212,7 @@ const wSnippetMenu = weSnippetEditor.SnippetsMenu.extend({ alwaysReconfigure: ev.data.reconfigure, configureIfNecessary: ev.data.configureIfNecessary, }); - this.getParent().trigger_up(gmapRequestEventName, { + this.getParent()._websiteRootEvent(gmapRequestEventName, { refetch: reconfigured, editableMode: true, onSuccess: key => ev.data.onSuccess(key),