From b6a08dc982d3f27006f62b6b2ba2e75547b63e75 Mon Sep 17 00:00:00 2001 From: fwi-odoo Date: Mon, 12 Jun 2017 10:36:59 +0200 Subject: [PATCH] [FIX] web: hide 'duplicate' action for ir.model.fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It shouldn't be possible to duplicate ir.model.fields. Add attribute ´duplicate´ which can be set to false to hide the duplication option in the action menu. --- addons/web/static/src/js/views/form_view.js | 3 ++- openerp/addons/base/ir/ir_model_view.xml | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/views/form_view.js b/addons/web/static/src/js/views/form_view.js index faa9bae26cd..e40598741b4 100644 --- a/addons/web/static/src/js/views/form_view.js +++ b/addons/web/static/src/js/views/form_view.js @@ -208,9 +208,10 @@ var FormView = View.extend(common.FieldManagerMixin, { if (this.fields_view.toolbar) { this.sidebar.add_toolbar(this.fields_view.toolbar); } + var canDuplicate = this.is_action_enabled('create') && this.is_action_enabled('duplicate'); this.sidebar.add_items('other', _.compact([ this.is_action_enabled('delete') && { label: _t('Delete'), callback: this.on_button_delete }, - this.is_action_enabled('create') && { label: _t('Duplicate'), callback: this.on_button_duplicate } + canDuplicate && { label: _t('Duplicate'), callback: this.on_button_duplicate } ])); $node = $node || this.$('.oe_form_sidebar'); diff --git a/openerp/addons/base/ir/ir_model_view.xml b/openerp/addons/base/ir/ir_model_view.xml index 7a8cd7ed1b9..032a65dfef1 100644 --- a/openerp/addons/base/ir/ir_model_view.xml +++ b/openerp/addons/base/ir/ir_model_view.xml @@ -212,7 +212,7 @@ ir.model.fields -
+ @@ -315,7 +315,7 @@ ir.model.fields - +