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/basic/basic_controller.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src/js/views/basic') 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 064f7b84a52..9e9e7559ede 100644 --- a/addons/web/static/src/js/views/basic/basic_controller.js +++ b/addons/web/static/src/js/views/basic/basic_controller.js @@ -373,14 +373,16 @@ var BasicController = AbstractController.extend(FieldManagerMixin, { * the new record to be in edit mode too, but the view manager calls * this function as the URL changes...) @todo get rid of this when * the webclient/action_manager's hashchange mechanism is improved. + * @param {boolean} [options.noAbandon=false] * @returns {Promise} */ _discardChanges: function (recordID, options) { var self = this; recordID = recordID || this.handle; + options = options || {}; return this.canBeDiscarded(recordID) .then(function (needDiscard) { - if (options && options.readonlyIfRealDiscard && !needDiscard) { + if (options.noAbandon || (options.readonlyIfRealDiscard && !needDiscard)) { return; } self.model.discardChanges(recordID); -- cgit v1.2.3