diff options
| author | Denis Ledoux <dle@openerp.com> | 2014-02-20 15:13:02 +0100 |
|---|---|---|
| committer | Denis Ledoux <dle@openerp.com> | 2014-02-20 15:13:02 +0100 |
| commit | 2a4d8bc6d5e1e0efa382beb3381460f49d201dec (patch) | |
| tree | c742278f65d22bf52f380b279712068b67abb98a /addons/web/static/src | |
| parent | b0f1e57269f62f57ae97d8e562ee81927257b75c (diff) | |
[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
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 599664d14de..f1fc377fa94 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -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; }); |
