diff options
| author | qsm-odoo <qsm@odoo.com> | 2020-06-05 15:16:32 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2020-06-05 16:34:23 +0000 |
| commit | 4f64fa3e78b480b8e0dc7fc903d2f8f2e7107d82 (patch) | |
| tree | 43f8572017567c31588ef5b551e12eeb04fdfe28 /addons/website/static/src/js/editor/editor_menu.js | |
| parent | 1c5771a4124da09db49d1c6c0192b6e6ff016021 (diff) | |
[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: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/website/static/src/js/editor/editor_menu.js')
| -rw-r--r-- | addons/website/static/src/js/editor/editor_menu.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/addons/website/static/src/js/editor/editor_menu.js b/addons/website/static/src/js/editor/editor_menu.js index dbeba41a7c5..c78e48f13ad 100644 --- a/addons/website/static/src/js/editor/editor_menu.js +++ b/addons/website/static/src/js/editor/editor_menu.js @@ -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; }); }, /** |
