[IMP] website: open the theme_install_kanban_action in the webclient

Before this commit, the switchTheme option was redirecting the window to
the theme_install_kanban_action url.

After [1] was merged, the editor is instantiated inside the webclient
and the action can now be opened directly from there, without a reload.

For that, the request_save event data can include an 'action' parameter,
which the WysiwygAdapter will use after leaving debug mode to trigger
the action with the action service.

[1]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b

task-2687506

closes odoo/odoo#81485

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
Younn Olivier
2022-07-08 19:52:09 +02:00
committed by qsm-odoo
parent 1ff7f1e8b6
commit cb68632d8a
2 changed files with 7 additions and 1 deletions
@@ -30,6 +30,7 @@ export class WysiwygAdapterComponent extends ComponentAdapter {
this.rpc = useWowlService('rpc');
this.orm = useWowlService('orm');
this.dialogs = useWowlService('dialog');
this.action = useWowlService('action');
this.oeStructureSelector = '#wrapwrap .oe_structure[data-oe-xpath][data-oe-id]';
this.oeFieldSelector = '#wrapwrap [data-oe-field]';
@@ -558,6 +559,11 @@ export class WysiwygAdapterComponent extends ComponentAdapter {
const currentPath = encodeURIComponent(window.location.pathname);
const websiteId = this.websiteService.currentWebsite.id;
callback = () => window.location = `/web#action=website.website_preview&website_id=${websiteId}&path=${currentPath}&enable_editor=1`;
} else if (event.data.action) {
callback = () => {
this.websiteService.leaveEditMode();
this.action.doAction(event.data.action);
};
}
if (isDirty) {
return this.save().then(callback);
@@ -1186,7 +1186,7 @@ options.registry.OptionsTab = options.Class.extend({
}
this.trigger_up('request_save', {
reload: false,
onSuccess: () => window.location.href = '/web#action=website.theme_install_kanban_action',
action: 'website.theme_install_kanban_action',
});
},