diff --git a/partner_deduplicate_acl/README.rst b/partner_deduplicate_acl/README.rst new file mode 100644 index 000000000..3666d56aa --- /dev/null +++ b/partner_deduplicate_acl/README.rst @@ -0,0 +1,96 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +======================== +Deduplicate Contacts ACL +======================== + +This module extends the functionality of the CRM contact deduplicator to add +permission groups that allow the matching users to use those tools, not +needing to be the sale settings manager. + +Configuration +============= + +To configure this module, you need to: + +#. Go to *Settings > Users > Users*. +#. Choose a user. +#. Choose the desired permission level(s) in *Appplication > Deduplicate + Contacts*: + + - *Manually* allows him to do the manual deduplication process. + - *Automatically* allows him to do the automatic deduplication process. + + .. warning:: + Automatic contact deduplication can easily lead to unwanted results. + Better backup before doing it. + + - *Without restrictions* executes the chosen deduplication method with admin + rigts, to be able to update objects where the user would normally not have + write rights, and to allow him to merge contacts with different email + addresses. + + .. warning:: + This is an advanced feature, be sure to train the user before enabling + this permission for him. + +Usage +===== + +To use this module, you need to: + +#. Ask your admin to give you the new rigts. +#. Go to *Sales > Tools > Deduplicate Contacts* as usual. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/111/8.0 + +Known issues / Roadmap +====================== + +* Wizard's code is partially written in old API because somehow [possibly] + the upstream's ``@mute_logger`` decorator prevents API from doing its magic. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed `feedback +`_. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Rafael Blasco +* Jairo Llopis + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/partner_deduplicate_acl/__init__.py b/partner_deduplicate_acl/__init__.py new file mode 100644 index 000000000..a803d44dd --- /dev/null +++ b/partner_deduplicate_acl/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2016 Antiun Ingeniería S.L. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import wizards diff --git a/partner_deduplicate_acl/__openerp__.py b/partner_deduplicate_acl/__openerp__.py new file mode 100644 index 000000000..76d2e015b --- /dev/null +++ b/partner_deduplicate_acl/__openerp__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# © 2016 Antiun Ingeniería S.L. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Deduplicate Contacts ACL", + "summary": "Contact deduplication with fine-grained permission control", + "version": "8.0.1.0.0", + "category": "Tools", + "website": "http://www.antiun.com", + "author": "Antiun Ingeniería S.L., Odoo Community Association (OCA)", + "license": "AGPL-3", + "application": False, + "installable": True, + "depends": [ + "crm", + ], + "data": [ + "security/crm_deduplicate_acl_security.xml", + "wizards/partner_merge_view.xml", + ], + "images": [ + "images/perms.png", + ], +} diff --git a/partner_deduplicate_acl/i18n/es.po b/partner_deduplicate_acl/i18n/es.po new file mode 100644 index 000000000..6fd866a6b --- /dev/null +++ b/partner_deduplicate_acl/i18n/es.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_deduplicate_acl +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-02-18 16:30+0000\n" +"PO-Revision-Date: 2016-02-18 17:32+0100\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" +"Language: es\n" +"X-Generator: Poedit 1.8.6\n" + +#. module: crm_deduplicate_acl +#: model:res.groups,name:crm_deduplicate_acl.group_automatically +msgid "Automatically" +msgstr "Automáticamente" + +#. module: crm_deduplicate_acl +#: model:ir.module.category,name:crm_deduplicate_acl.category +msgid "Deduplicate Contacts" +msgstr "Deduplicar contactos" + +#. module: crm_deduplicate_acl +#: model:res.groups,name:crm_deduplicate_acl.group_manually +msgid "Manually" +msgstr "Manualmente" + +#. module: crm_deduplicate_acl +#: model:res.groups,name:crm_deduplicate_acl.group_unrestricted +msgid "Without restrictions" +msgstr "Sin restricciones" + +#. module: crm_deduplicate_acl +#: view:base.partner.merge.automatic.wizard:crm_deduplicate_acl.base_partner_merge_automatic_wizard_form +msgid "crm_deduplicate_acl.group_automatically" +msgstr "crm_deduplicate_acl.group_automatically" diff --git a/partner_deduplicate_acl/images/perms.png b/partner_deduplicate_acl/images/perms.png new file mode 100644 index 000000000..aacf5528d Binary files /dev/null and b/partner_deduplicate_acl/images/perms.png differ diff --git a/partner_deduplicate_acl/security/crm_deduplicate_acl_security.xml b/partner_deduplicate_acl/security/crm_deduplicate_acl_security.xml new file mode 100644 index 000000000..e4338d619 --- /dev/null +++ b/partner_deduplicate_acl/security/crm_deduplicate_acl_security.xml @@ -0,0 +1,44 @@ + + + + + + + + + Deduplicate Contacts + + + + + Manually + + + + + Automatically + + + + + + Without restrictions + + + + + + + + + + + + + + + + diff --git a/partner_deduplicate_acl/static/description/icon.png b/partner_deduplicate_acl/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/partner_deduplicate_acl/static/description/icon.png differ diff --git a/partner_deduplicate_acl/wizards/__init__.py b/partner_deduplicate_acl/wizards/__init__.py new file mode 100644 index 000000000..c93eadfed --- /dev/null +++ b/partner_deduplicate_acl/wizards/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2016 Antiun Ingeniería S.L. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import partner_merge diff --git a/partner_deduplicate_acl/wizards/partner_merge.py b/partner_deduplicate_acl/wizards/partner_merge.py new file mode 100644 index 000000000..babd38527 --- /dev/null +++ b/partner_deduplicate_acl/wizards/partner_merge.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# © 2016 Antiun Ingeniería S.L. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp import SUPERUSER_ID, api, models + + +class BasePartnerMergeAutomaticWizard(models.TransientModel): + _inherit = "base.partner.merge.automatic.wizard" + + @api.cr_uid_context + def _merge(self, cr, uid, partner_ids, dst_partner=None, context=None): + """Allow non-admins to merge partners with different emails.""" + # Know if user has unrestricted access + group_unrestricted = self.pool["ir.model.data"].xmlid_to_object( + cr, uid, "crm_deduplicate_acl.group_unrestricted", context) + user = self.pool["res.users"].browse(cr, uid, uid, context) + + # Run as admin if so + return super(BasePartnerMergeAutomaticWizard, self)._merge( + cr, + SUPERUSER_ID if group_unrestricted in user.groups_id else uid, + partner_ids, + dst_partner, + context) diff --git a/partner_deduplicate_acl/wizards/partner_merge_view.xml b/partner_deduplicate_acl/wizards/partner_merge_view.xml new file mode 100644 index 000000000..9abc6a311 --- /dev/null +++ b/partner_deduplicate_acl/wizards/partner_merge_view.xml @@ -0,0 +1,31 @@ + + + + + + + + Restrict automatic merge access + base.partner.merge.automatic.wizard + + + + + crm_deduplicate_acl.group_automatically + + + + + crm_deduplicate_acl.group_automatically + + + + + + +