Add possibility to make an exception on some form views in web_eradicate_duplicate
This commit is contained in:
@@ -10,7 +10,14 @@ openerp.web_eradicate_duplicate = function (instance) {
|
||||
load_form: function(data) {
|
||||
this._super(data);
|
||||
// Remove More > Duplicate button for all users except admin
|
||||
if (this.session.uid != 1 && this.sidebar && this.sidebar.items && this.sidebar.items.other) {
|
||||
// or except if there is an attribute duplicate_eradicate="false"
|
||||
// in the form view
|
||||
if (
|
||||
this.sidebar &&
|
||||
this.sidebar.items &&
|
||||
this.sidebar.items.other &&
|
||||
this.session.uid != 1 &&
|
||||
this.is_action_enabled('eradicate_duplicate')) {
|
||||
var new_items_other = _.reject(this.sidebar.items.other, function (item) {
|
||||
return item.label === _t('Duplicate');
|
||||
});
|
||||
@@ -19,3 +26,20 @@ openerp.web_eradicate_duplicate = function (instance) {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
EXAMPLE : enable duplicate on account.move :
|
||||
|
||||
<record id="view_move_form" model="ir.ui.view">
|
||||
<field name="name">duplicate_allowed.account_move_form</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_move_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form" position="attributes">
|
||||
<attribute name="eradicate_duplicate">false</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user