From a7a60f7c61275f26521cbc4ea0da2889095a5cc5 Mon Sep 17 00:00:00 2001 From: Mathieu Duckerts-Antoine Date: Mon, 23 Sep 2019 12:24:47 +0000 Subject: [FIX] web: avoid multiple displays of the "same" discard warning Before this commit, editing a record e.g. in a form view and toggling the home menu would cause the discard warning to be displayed twice when going to the home menu (in enterprise) and then once again when going to an other app. This is now fixed. Task ID: 2043027 closes odoo/odoo#37301 Signed-off-by: VincentSchippefilt Co-authored-by: Mohammed Shekha Co-authored-by: aab-odoo --- addons/web/static/src/js/views/basic/basic_controller.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src/js/views/basic/basic_controller.js') diff --git a/addons/web/static/src/js/views/basic/basic_controller.js b/addons/web/static/src/js/views/basic/basic_controller.js index 9e9e7559ede..c82bf05996b 100644 --- a/addons/web/static/src/js/views/basic/basic_controller.js +++ b/addons/web/static/src/js/views/basic/basic_controller.js @@ -382,10 +382,13 @@ var BasicController = AbstractController.extend(FieldManagerMixin, { options = options || {}; return this.canBeDiscarded(recordID) .then(function (needDiscard) { - if (options.noAbandon || (options.readonlyIfRealDiscard && !needDiscard)) { + if (options.readonlyIfRealDiscard && !needDiscard) { return; } self.model.discardChanges(recordID); + if (options.noAbandon) { + return; + } if (self.model.canBeAbandoned(recordID)) { self._abandonRecord(recordID); return; -- cgit v1.2.3