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. --- addons/web/static/src/js/fields/relational_fields.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src/js/fields') diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index 459b529c748..481f5df89ad 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -93,7 +93,7 @@ var FieldMany2One = AbstractField.extend({ this._super.apply(this, arguments); this.limit = 7; this.orderer = new concurrency.DropMisordered(); - this.can_create = 'can_create' in this.attrs ? this.attrs.can_create : true; + this.can_create = ('can_create' in this.attrs ? this.attrs.can_create : true) && !this.nodeOptions.no_create; this.can_write = 'can_write' in this.attrs ? this.attrs.can_write : true; this.nodeOptions = _.defaults(this.nodeOptions, { quick_create: true, -- cgit v1.2.3