[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) <rde@odoo.com>
This commit is contained in:
Soukéina Bojabza
2023-09-11 23:59:48 +00:00
parent 619e5e0dad
commit 68d89150b1
@@ -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),