diff --git a/web_eradicate_duplicate/__manifest__.py b/web_eradicate_duplicate/__manifest__.py index dda25e1..fd2af8e 100644 --- a/web_eradicate_duplicate/__manifest__.py +++ b/web_eradicate_duplicate/__manifest__.py @@ -1,37 +1,20 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Web Eradicate Duplicate module for Odoo -# Copyright (C) 2016 Akretion (http://www.akretion.com) -# @author Alexis de Lattre -# -# 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 . -# -############################################################################## +# Copyright (C) 2016-2018 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Eradicate Duplicate', - 'version': '8.0.0.1.0', + 'version': '10.0.1.0.0', 'category': 'Tools', 'license': 'AGPL-3', - 'summary': 'Remove More > Duplicate for all users except admin', + 'summary': 'Remove Action > Duplicate for all users except admin', 'description': ''' 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). @@ -41,5 +24,5 @@ This module has been written by Alexis de Lattre from Akretion 'author': 'Akretion', 'depends': ['web'], 'data': ['views/eradicate_duplicate.xml'], - 'installable': False, + 'installable': True, } diff --git a/web_eradicate_duplicate/static/src/js/eradicate_duplicate.js b/web_eradicate_duplicate/static/src/js/eradicate_duplicate.js index bf417d8..48c42cd 100644 --- a/web_eradicate_duplicate/static/src/js/eradicate_duplicate.js +++ b/web_eradicate_duplicate/static/src/js/eradicate_duplicate.js @@ -3,13 +3,17 @@ Inspired by the module web_hide_duplicate of Aristobulo Meneses */ -openerp.web_eradicate_duplicate = function (instance) { - var _t = instance.web._t; +odoo.define('web.web_eradicate_duplicate', function(require) { + "use strict"; - instance.web.FormView.include({ - load_form: function(data) { - this._super(data); - // Remove More > Duplicate button for all users except admin + var core = require('web.core'); + var FormView = require('web.FormView'); + var _t = core._t; + + 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" // in the form view if ( @@ -25,7 +29,7 @@ openerp.web_eradicate_duplicate = function (instance) { } } }); -}; +}); /* diff --git a/web_eradicate_duplicate/views/eradicate_duplicate.xml b/web_eradicate_duplicate/views/eradicate_duplicate.xml index 5604c09..3ac0b64 100644 --- a/web_eradicate_duplicate/views/eradicate_duplicate.xml +++ b/web_eradicate_duplicate/views/eradicate_duplicate.xml @@ -1,6 +1,5 @@ - - + - - +