[IMP] added possibility to desactivate quick create in m2o
bzr revid: nicolas.vanhoren@openerp.com-20130822100030-39ipz56hkrtq8pw0
This commit is contained in:
parent
525aee7a86
commit
4cc2766b2e
|
@ -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 = {
|
instance.web.form.CompletionFieldMixin = {
|
||||||
init: function() {
|
init: function() {
|
||||||
this.limit = 7;
|
this.limit = 7;
|
||||||
|
@ -3044,7 +3047,8 @@ instance.web.form.CompletionFieldMixin = {
|
||||||
}
|
}
|
||||||
// quick create
|
// quick create
|
||||||
var raw_result = _(data.result).map(function(x) {return x[1];});
|
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({
|
values.push({
|
||||||
label: _.str.sprintf(_t('Create "<strong>%s</strong>"'),
|
label: _.str.sprintf(_t('Create "<strong>%s</strong>"'),
|
||||||
$('<span />').text(search_val).html()),
|
$('<span />').text(search_val).html()),
|
||||||
|
|
Loading…
Reference in New Issue