[ADD] web: add no_create option in view_form, allowing to remove create and edit (and quick create)
Before, we used to use selection widget to hide or disable the create and edit of many2one fields, but this is actually an abuse of the selection widget, this is not its purpose bzr revid: dle@openerp.com-20140220141302-3paib80ixiyi66qg
This commit is contained in:
@@ -3092,7 +3092,7 @@ 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) &&
|
||||
! (self.options && self.options.no_quick_create)) {
|
||||
! (self.options && (self.options.no_create || self.options.no_quick_create))) {
|
||||
values.push({
|
||||
label: _.str.sprintf(_t('Create "<strong>%s</strong>"'),
|
||||
$('<span />').text(search_val).html()),
|
||||
@@ -3103,13 +3103,15 @@ instance.web.form.CompletionFieldMixin = {
|
||||
});
|
||||
}
|
||||
// create...
|
||||
values.push({
|
||||
label: _t("Create and Edit..."),
|
||||
action: function() {
|
||||
self._search_create_popup("form", undefined, self._create_context(search_val));
|
||||
},
|
||||
classname: 'oe_m2o_dropdown_option'
|
||||
});
|
||||
if (!(self.options && self.options.no_create)){
|
||||
values.push({
|
||||
label: _t("Create and Edit..."),
|
||||
action: function() {
|
||||
self._search_create_popup("form", undefined, self._create_context(search_val));
|
||||
},
|
||||
classname: 'oe_m2o_dropdown_option'
|
||||
});
|
||||
}
|
||||
|
||||
return values;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user