Skip to content
Snippets Groups Projects
Commit 4f64fa3e authored by qsm-odoo's avatar qsm-odoo
Browse files

[FIX] website: prevent saving multiple times in a row


While waiting for a better and more robust fix in the editor itself,
this prevents to hit the save button of the website editor while a save
is in progress.

closes odoo/odoo#52540

Signed-off-by: default avatarQuentin Smetz (qsm) <qsm@odoo.com>
parent 1c5771a4
No related branches found
No related tags found
No related merge requests found
......@@ -108,10 +108,14 @@ var EditorMenu = Widget.extend({
*
* @param {boolean} [reload=true]
* true if the page has to be reloaded after the save
* @returns {Deferred}
* @returns {Promise}
*/
save: function (reload) {
save: async function (reload) {
if (this._saving) {
return false;
}
var self = this;
this._saving = true;
this.trigger_up('edition_will_stopped');
return this.wysiwyg.save(false).then(function (result) {
var $wrapwrap = $('#wrapwrap');
......@@ -125,6 +129,9 @@ var EditorMenu = Widget.extend({
self.trigger_up('edition_was_stopped');
self.destroy();
}
return true;
}).guardedCatch(() => {
this._saving = false;
});
},
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment