summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/abstract_controller.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2019-05-08 09:58:42 +0000
committerAaron Bohy <aab@odoo.com>2019-07-18 09:48:07 +0000
commite0c7c8e288178b0621d0265f61a3c6cc229fe3d9 (patch)
tree06ee46fa477c0ebaa7edddafe115157a18b71d06 /addons/web/static/src/js/views/abstract_controller.js
parentf9565d63346504b29b6c401ad03e4de27b309203 (diff)
[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 <VincentSchippefilt@users.noreply.github.com>
Diffstat (limited to 'addons/web/static/src/js/views/abstract_controller.js')
-rw-r--r--addons/web/static/src/js/views/abstract_controller.js10
1 files changed, 7 insertions, 3 deletions
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();
},
/**