[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.
This commit is contained in:
Christophe Matthieu
2017-04-28 11:32:05 +02:00
committed by Géry Debongnie
parent 76e6a0e356
commit 9da93dc232
3 changed files with 27 additions and 6 deletions
@@ -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 string="Partners">' +
'<sheet>' +
'<field name="product_id" options="{\'no_create\': True}"/>' +
'</sheet>' +
'</form>',
});
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) {