[IMP] added possibility to desactivate quick create in m2o

bzr revid: nicolas.vanhoren@openerp.com-20130822100030-39ipz56hkrtq8pw0
This commit is contained in:
niv-openerp 2013-08-22 12:00:30 +02:00
parent 525aee7a86
commit 4cc2766b2e
1 changed files with 7 additions and 3 deletions

View File

@ -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 "<strong>%s</strong>"'),
$('<span />').text(search_val).html()),