summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/relational_fields/field_many2one_tests.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2020-01-16 14:59:05 +0000
committerAaron Bohy <aab@odoo.com>2020-01-21 11:59:22 +0000
commit50bf8309f88fb6c8d8e27b14d40450e92e5a4e4e (patch)
tree00b7deea11b94ec69ea6779b87644c39a750ab65 /addons/web/static/tests/fields/relational_fields/field_many2one_tests.js
parent01e3a5996f9fab841be270b84f0877d0b8b9fc37 (diff)
[FIX] web,*: fix race condition with m2o quick create
*sale,sale_product_configurator Let's assume a form view containing a many2one with an onchange that updates the value of a one2many. Do a quick create in the many2one. While the name_create request is pending, add a row to the one2many but do not leave it. When the name_create returns, and the onchange has been performed, the one2many is reset, and the row is no longer in edition (worse, it could be invalid, i.e. in a state that the user could not have reached in a normal situation). This commit fixes this issue by considering the whole [name_create + onchange] operation as one. This operation is executed in the mutex of the model, so the other request (adding a row to the one2many) is delayed until the many2one value has been correctly set. This fixes an issue with the sale and rental tours (on sale_order), that had been deactivated for a while.
Diffstat (limited to 'addons/web/static/tests/fields/relational_fields/field_many2one_tests.js')
-rw-r--r--addons/web/static/tests/fields/relational_fields/field_many2one_tests.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/addons/web/static/tests/fields/relational_fields/field_many2one_tests.js b/addons/web/static/tests/fields/relational_fields/field_many2one_tests.js
index 8c84cf4edf2..46c6ebbe798 100644
--- a/addons/web/static/tests/fields/relational_fields/field_many2one_tests.js
+++ b/addons/web/static/tests/fields/relational_fields/field_many2one_tests.js
@@ -967,6 +967,7 @@ QUnit.module('fields', {}, function () {
},
});
var parent = new StandaloneWidget(model);
+ model.setParent(parent);
testUtils.mock.addMockEnvironment(parent, {
data: self.data,
mockRPC: function (route, args) {