From 8993d6ff796ffbac056f9808557d2dbfca01b62d Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Fri, 14 Sep 2018 16:25:43 +0200 Subject: [FIX] web: x2Many: remove deadlock situation This rev. is similar to db9b91ff, but treats the x2many case. Calls to the 'commitChange' function of renderers must not be done inside a mutex, mainly since 241704536, as they could end up in a deadlock. For x2manys, it was actually the case in practice in Inventory > Operations > Inventory Adjustments > Create > select 'One product only' > select a product > try to edit the real quantity in the editable list > focusout > deadlock. The reason why the deadlock occurred in this view and not in, e.g. sale.order, is due to the presence of the field_float_scannable widget. Indeed, the barcode engine intercepts input events and manually re-triggers them. As a consequence, the 'change' event is not triggered on the field, and it does not notify the environment of its new value by itself, until the field x2many asks it to commit its value. Note that this might be an issue as well, as onchanges are thus not triggered. Task 1878254 --- addons/web/static/src/js/fields/relational_fields.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'addons/web/static/src/js/fields/relational_fields.js') diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index 4c92c0973b9..a1efa85498e 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -1221,18 +1221,14 @@ var FieldX2Many = AbstractField.extend({ _onSaveLine: function (ev) { var self = this; ev.stopPropagation(); - this.trigger_up('mutexify', { - action: function () { - return self.renderer.commitChanges(ev.data.recordID).then(function () { - self.trigger_up('mutexify', { - action: function () { - return self._saveLine(ev.data.recordID) - .done(ev.data.onSuccess) - .fail(ev.data.onFailure); - }, - }); - }); - }, + this.renderer.commitChanges(ev.data.recordID).then(function () { + self.trigger_up('mutexify', { + action: function () { + return self._saveLine(ev.data.recordID) + .done(ev.data.onSuccess) + .fail(ev.data.onFailure); + }, + }); }); }, /** -- cgit v1.2.3