diff --git a/edit_save_button/static/src/views/form/form_controller.js b/edit_save_button/static/src/views/form/form_controller.js index a94948397..019460aa1 100644 --- a/edit_save_button/static/src/views/form/form_controller.js +++ b/edit_save_button/static/src/views/form/form_controller.js @@ -30,10 +30,12 @@ patch(FormController.prototype, "save", { data = true; await this.model.root.switchMode("edit"); }, - async saveButtonClicked(params = {}){ - this._super(); + async saveButtonClicked(params = {}) { + let saved = await this._super(); data = false; - await this.model.root.switchMode("readonly"); + if (saved) { + await this.model.root.switchMode("readonly"); + } }, async discard() { this._super();