From 211961c3747b5948e80ad8eb6f097636bc61b46d Mon Sep 17 00:00:00 2001 From: Martin Geubelle Date: Tue, 1 Aug 2017 17:55:24 +0200 Subject: [FIX] web: handle `mutexify` in standalone widgets The rev. https://github.com/odoo/odoo/commit/99ae418bf24171fbc6bb27584059c27efb857e77 introduced a trigger_up `mutexify` when quick creating a record in a many2one ; this broke the behaviour when the many2one was standalone (because it has no BasicController and mutexify is handled in the latter). An attempt to fix this issue has been made in the rev. https://github.com/odoo/odoo/commit/e83c3e2678500c9bf2c17b4d23ae9a294ebafaa7 by adding an option `standalone` in the field widget options. In this case, the action was directly executed instead of the trigger_up. While this correctly works, this implies that the option needs to be added in every standalone many2one (and only many2one as the others won't use the option), which is not very convenient. An other attempt is made in this rev. by moving the mutexify handler from the BasicController to the FieldManagerMixin ; as a widget that instantiates a field widget needs to extend this mixin, both cases will work and we won't need to specify the option anymore. This commit thus partially reverts the rev. https://github.com/odoo/odoo/commit/e83c3e2678500c9bf2c17b4d23ae9a294ebafaa7 --- addons/web/static/src/js/views/basic/basic_controller.js | 12 ------------ 1 file changed, 12 deletions(-) (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 39e596db5b8..3a47f65ab03 100644 --- a/addons/web/static/src/js/views/basic/basic_controller.js +++ b/addons/web/static/src/js/views/basic/basic_controller.js @@ -8,7 +8,6 @@ odoo.define('web.BasicController', function (require) { */ var AbstractController = require('web.AbstractController'); -var concurrency = require('web.concurrency'); var core = require('web.core'); var Dialog = require('web.Dialog'); var FieldManagerMixin = require('web.FieldManagerMixin'); @@ -19,7 +18,6 @@ var _t = core._t; var BasicController = AbstractController.extend(FieldManagerMixin, { custom_events: _.extend({}, AbstractController.prototype.custom_events, FieldManagerMixin.custom_events, { discard_changes: '_onDiscardChanges', - mutexify: '_onMutexify', reload: '_onReload', sidebar_data_asked: '_onSidebarDataAsked', translate: '_onTranslate', @@ -39,7 +37,6 @@ var BasicController = AbstractController.extend(FieldManagerMixin, { FieldManagerMixin.init.call(this, this.model); this.handle = params.initialState.id; this.mode = params.mode || 'readonly'; - this.mutex = new concurrency.Mutex(); }, /** * @override @@ -526,15 +523,6 @@ var BasicController = AbstractController.extend(FieldManagerMixin, { } FieldManagerMixin._onFieldChanged.apply(this, arguments); }, - /** - * @private - * @param {OdooEvent} ev - * @param {function} ev.data.action the function to execute in the mutex - */ - _onMutexify: function (ev) { - ev.stopPropagation(); // prevent other controllers from handling this request - this.mutex.exec(ev.data.action); - }, /** * When a reload event triggers up, we need to reload the full view. * For example, after a form view dialog saved some data. -- cgit v1.2.3