From e0c7c8e288178b0621d0265f61a3c6cc229fe3d9 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Wed, 8 May 2019 09:58:42 +0000 Subject: [FIX] web: execute action from new record and go back Let's assume a form view with a readonly many2one field with a default value. When creating a new record, the user can click on the many2one value, which should open the related record in a form view (stacked in the breadcrumbs). Before this rev., this didn't work: we actually came back to the previous view/action in the breadcrumbs, when trying to open the related record. closes odoo/odoo#33172 Signed-off-by: VincentSchippefilt --- addons/web/static/src/js/views/abstract_controller.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'addons/web/static/src/js/views/abstract_controller.js') diff --git a/addons/web/static/src/js/views/abstract_controller.js b/addons/web/static/src/js/views/abstract_controller.js index 607f49c8031..63d59d153fd 100644 --- a/addons/web/static/src/js/views/abstract_controller.js +++ b/addons/web/static/src/js/views/abstract_controller.js @@ -122,8 +122,11 @@ var AbstractController = mvc.Controller.extend(ActionMixin, { * @override */ canBeRemoved: function () { - // AAB: get rid of this option when on_hashchange mechanism is improved - return this.discardChanges(undefined, { readonlyIfRealDiscard: true }); + // AAB: get rid of 'readonlyIfRealDiscard' option when on_hashchange mechanism is improved + return this.discardChanges(undefined, { + noAbandon: true, + readonlyIfRealDiscard: true, + }); }, /** * Discards the changes made on the record associated to the given ID, or @@ -137,9 +140,10 @@ var AbstractController = mvc.Controller.extend(ActionMixin, { * * @param {string} [recordID] * if not given, we consider all the changes made by the controller + * @param {Object} [options] * @returns {Promise} resolved if properly discarded, rejected otherwise */ - discardChanges: function (recordID) { + discardChanges: function (recordID, options) { return Promise.resolve(); }, /** -- cgit v1.2.3