[MIG] web_eradicate_duplicate to v10
This commit is contained in:
@@ -1,37 +1,20 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
##############################################################################
|
# Copyright (C) 2016-2018 Akretion (http://www.akretion.com)
|
||||||
#
|
|
||||||
# Web Eradicate Duplicate module for Odoo
|
|
||||||
# Copyright (C) 2016 Akretion (http://www.akretion.com)
|
|
||||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
#
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Affero General Public License as
|
|
||||||
# published by the Free Software Foundation, either version 3 of the
|
|
||||||
# License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Affero General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Eradicate Duplicate',
|
'name': 'Eradicate Duplicate',
|
||||||
'version': '8.0.0.1.0',
|
'version': '10.0.1.0.0',
|
||||||
'category': 'Tools',
|
'category': 'Tools',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'summary': 'Remove More > Duplicate for all users except admin',
|
'summary': 'Remove Action > Duplicate for all users except admin',
|
||||||
'description': '''
|
'description': '''
|
||||||
Eradicate Duplicate
|
Eradicate Duplicate
|
||||||
===================
|
===================
|
||||||
|
|
||||||
This module is inspired by the module *web_hide_duplicate* of Aristobulo Meneses available on https://github.com/menecio/odoo-addons. The main difference is that it will remove the *More > Duplicate* button everywhere by default for all users except *admin*.
|
This module is inspired by the module *web_hide_duplicate* of Aristobulo Meneses available on https://github.com/menecio/odoo-addons (it seems this URL doesn't exist any more, so I don't know where the module is located now). The main difference is that it will remove the *Action > Duplicate* button everywhere by default for all users except *admin*.
|
||||||
|
|
||||||
It is possible to restore the duplicate feature on some form views by adding an attribute **duplicate_eradicate="false"** (you will find an example in a comment at the end of the file static/src/js/eradicate_duplicate.js).
|
It is possible to restore the duplicate feature on some form views by adding an attribute **duplicate_eradicate="false"** (you will find an example in a comment at the end of the file static/src/js/eradicate_duplicate.js).
|
||||||
|
|
||||||
@@ -41,5 +24,5 @@ This module has been written by Alexis de Lattre from Akretion
|
|||||||
'author': 'Akretion',
|
'author': 'Akretion',
|
||||||
'depends': ['web'],
|
'depends': ['web'],
|
||||||
'data': ['views/eradicate_duplicate.xml'],
|
'data': ['views/eradicate_duplicate.xml'],
|
||||||
'installable': False,
|
'installable': True,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,17 @@
|
|||||||
Inspired by the module web_hide_duplicate of Aristobulo Meneses
|
Inspired by the module web_hide_duplicate of Aristobulo Meneses
|
||||||
*/
|
*/
|
||||||
|
|
||||||
openerp.web_eradicate_duplicate = function (instance) {
|
odoo.define('web.web_eradicate_duplicate', function(require) {
|
||||||
var _t = instance.web._t;
|
"use strict";
|
||||||
|
|
||||||
instance.web.FormView.include({
|
var core = require('web.core');
|
||||||
load_form: function(data) {
|
var FormView = require('web.FormView');
|
||||||
this._super(data);
|
var _t = core._t;
|
||||||
// Remove More > Duplicate button for all users except admin
|
|
||||||
|
FormView.include({
|
||||||
|
render_sidebar: function($node) {
|
||||||
|
this._super($node);
|
||||||
|
// Remove Action > Duplicate button for all users except admin
|
||||||
// or except if there is an attribute duplicate_eradicate="false"
|
// or except if there is an attribute duplicate_eradicate="false"
|
||||||
// in the form view
|
// in the form view
|
||||||
if (
|
if (
|
||||||
@@ -25,7 +29,7 @@ openerp.web_eradicate_duplicate = function (instance) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<openerp>
|
<odoo>
|
||||||
<data>
|
|
||||||
|
|
||||||
<template id="assets_backend" name="eradicate_duplicate" inherit_id="web.assets_backend">
|
<template id="assets_backend" name="eradicate_duplicate" inherit_id="web.assets_backend">
|
||||||
<xpath expr="." position="inside">
|
<xpath expr="." position="inside">
|
||||||
@@ -8,5 +7,4 @@
|
|||||||
</xpath>
|
</xpath>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</data>
|
</odoo>
|
||||||
</openerp>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user