From 9da93dc2327d43958d47a3f1029f8de86fc007ee Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 26 Apr 2017 13:47:32 +0200 Subject: [FIX] web: prevent record creation in M2O with option {'no_create': True} before this fix, if you enter a random string and exit focus you'll be prompted to create it. --- .../static/tests/fields/relational_fields_tests.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'addons/web/static/tests/fields/relational_fields_tests.js') diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js index b497e6da3f4..3996da81854 100644 --- a/addons/web/static/tests/fields/relational_fields_tests.js +++ b/addons/web/static/tests/fields/relational_fields_tests.js @@ -557,6 +557,27 @@ QUnit.module('relational_fields', { form.destroy(); }); + QUnit.test('no_create option on a many2one', function (assert) { + assert.expect(1); + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: '
' + + '' + + '' + + '' + + '
', + }); + + form.$('.o_form_field_many2one input').focus(); + form.$('.o_form_field_many2one input').val('new partner').trigger('keyup').trigger('focusout'); + + assert.strictEqual($('.modal').length, 0, "should not display the create modal"); + form.destroy(); + }); + QUnit.module('FieldOne2Many'); QUnit.test('one2many basic properties', function (assert) { -- cgit v1.2.3