[FIX] web: hide 'duplicate' action for ir.model.fields

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.
This commit is contained in:
fwi-odoo
2017-06-12 11:14:55 +02:00
parent 1aff1e3de8
commit b6a08dc982
2 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -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');
+2 -2
View File
@@ -212,7 +212,7 @@
<record id="view_model_fields_form" model="ir.ui.view">
<field name="model">ir.model.fields</field>
<field name="arch" type="xml">
<form string="Fields">
<form string="Fields" duplicate="false">
<sheet>
<group>
<field name="name"/>
@@ -315,7 +315,7 @@
<record id="view_model_fields_tree" model="ir.ui.view">
<field name="model">ir.model.fields</field>
<field name="arch" type="xml">
<tree string="Fields">
<tree string="Fields" duplicate="false">
<field name="name"/>
<field name="field_description"/>
<field name="model_id"/>