From 180de24df0d1c10d36b4f05e4b563f225b0a5ae3 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Mon, 19 Nov 2018 17:13:32 +0000 Subject: [PATCH] [FIX] website: allow publishers to save their website edition On save, the editor will ask to parent widgets if something needs to be done first. The website navbar will receive that demand and asks to its action-capable components to do something. For example, the content menu handles page-related options saving. However, some users with limited access rights do not have the content menu... but the website navbar expects that the save action is performed. So, this empty action is defined here so that all users have an 'on_save' related action. This was only happening since 12.0 as 'on_save' actions were introduced there to save page-related options. closes odoo/odoo#28810 --- addons/website/static/src/js/menu/edit.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/addons/website/static/src/js/menu/edit.js b/addons/website/static/src/js/menu/edit.js index 9fd0edd169c..fc5532a3a29 100644 --- a/addons/website/static/src/js/menu/edit.js +++ b/addons/website/static/src/js/menu/edit.js @@ -15,6 +15,7 @@ var EditPageMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({ xmlDependencies: ['/website/static/src/xml/website.editor.xml'], actions: _.extend({}, websiteNavbarData.WebsiteNavbarActionWidget.prototype.actions, { edit: '_startEditMode', + on_save: '_onSave', }), custom_events: _.extend({}, websiteNavbarData.WebsiteNavbarActionWidget.custom_events || {}, { snippet_dropped: '_onSnippetDropped', @@ -89,6 +90,19 @@ var EditPageMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({ return def; }); }, + /** + * On save, the editor will ask to parent widgets if something needs to be + * done first. The website navbar will receive that demand and asks to its + * action-capable components to do something. For example, the content menu + * handles page-related options saving. However, some users with limited + * access rights do not have the content menu... but the website navbar + * expects that the save action is performed. So, this empty action is + * defined here so that all users have an 'on_save' related action. + * + * @private + * @todo improve the system to somehow declare required/optional actions + */ + _onSave: function () {}, //-------------------------------------------------------------------------- // Handlers