From 4cc2766b2e456e2b79dd293355d3b9b90e3d117a Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 22 Aug 2013 12:00:30 +0200 Subject: [PATCH] [IMP] added possibility to desactivate quick create in m2o bzr revid: nicolas.vanhoren@openerp.com-20130822100030-39ipz56hkrtq8pw0 --- addons/web/static/src/js/view_form.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index d36ac353461..4f3aa3a8e1f 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2997,8 +2997,11 @@ instance.web.form.FieldRadio = instance.web.form.AbstractField.extend(instance.w })(); /** - * A mixin containing some useful methods to handle completion inputs. - */ + A mixin containing some useful methods to handle completion inputs. + + The widget containing this option can have these arguments in its widget options: + - no_quick_create: if true, it will disable the quick create +*/ instance.web.form.CompletionFieldMixin = { init: function() { this.limit = 7; @@ -3044,7 +3047,8 @@ instance.web.form.CompletionFieldMixin = { } // quick create var raw_result = _(data.result).map(function(x) {return x[1];}); - if (search_val.length > 0 && !_.include(raw_result, search_val)) { + if (search_val.length > 0 && !_.include(raw_result, search_val) && + ! (self.options && self.options.no_quick_create)) { values.push({ label: _.str.sprintf(_t('Create "%s"'), $('').text(search_val).html()),