Browse Source
[ADD] crm_deduplicate_acl: Deduplicate permission groups
[ADD] crm_deduplicate_acl: Deduplicate permission groups
This module allows any user to get special permissions to be able to
deduplicate contacts, instead of just giving them to a sale manager with
settings permissions.
The new permissions allow the user to deduplicate:
- *Manually*.
- *Automatically* (dangerous).
- *Without restrictions* (more dangerous).
Beware what you do! 😯
pull/721/head
Jairo Llopis
9 years ago
committed by
Pedro M. Baeza
10 changed files with 273 additions and 0 deletions
-
96partner_deduplicate_acl/README.rst
-
5partner_deduplicate_acl/__init__.py
-
24partner_deduplicate_acl/__openerp__.py
-
43partner_deduplicate_acl/i18n/es.po
-
BINpartner_deduplicate_acl/images/perms.png
-
44partner_deduplicate_acl/security/crm_deduplicate_acl_security.xml
-
BINpartner_deduplicate_acl/static/description/icon.png
-
5partner_deduplicate_acl/wizards/__init__.py
-
25partner_deduplicate_acl/wizards/partner_merge.py
-
31partner_deduplicate_acl/wizards/partner_merge_view.xml
@ -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 |
|||
<https://github.com/OCA/crm/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 |
|||
<https://github.com/OCA/ |
|||
crm/issues/new?body=module:%20 |
|||
crm_deduplicate_acl%0Aversion:%20 |
|||
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. |
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Images |
|||
------ |
|||
|
|||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* Rafael Blasco <rafabn@antiun.com> |
|||
* Jairo Llopis <yajo.sk8@gmail.com> |
|||
|
|||
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. |
@ -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 |
@ -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", |
|||
], |
|||
} |
@ -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" |
After Width: 454 | Height: 419 | Size: 74 KiB |
@ -0,0 +1,44 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- © 2016 Antiun Ingeniería S.L. - Jairo Llopis |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). --> |
|||
|
|||
<openerp> |
|||
<data> |
|||
|
|||
<!-- New user group category --> |
|||
<record id="category" model="ir.module.category"> |
|||
<field name="name">Deduplicate Contacts</field> |
|||
</record> |
|||
|
|||
<!-- New user groups --> |
|||
<record id="group_manually" model="res.groups"> |
|||
<field name="name">Manually</field> |
|||
<field name="category_id" ref="category"/> |
|||
</record> |
|||
|
|||
<record id="group_automatically" model="res.groups"> |
|||
<field name="name">Automatically</field> |
|||
<field name="category_id" ref="category"/> |
|||
<field name="implied_ids" eval="[(4, ref('group_manually'))]"/> |
|||
</record> |
|||
|
|||
<record id="group_unrestricted" model="res.groups"> |
|||
<field name="name">Without restrictions</field> |
|||
<field name="category_id" ref="category"/> |
|||
<field name="implied_ids" eval="[(4, ref('group_manually'))]"/> |
|||
</record> |
|||
|
|||
<!-- Respect previous behavior --> |
|||
<record id="base.group_system" model="res.groups"> |
|||
<field name="implied_ids" eval="[(4, ref('group_unrestricted'))]"/> |
|||
</record> |
|||
|
|||
<!-- New permission for menuitem --> |
|||
<record id="crm.partner_merge_automatic_menu" model="ir.ui.menu"> |
|||
<field |
|||
name="groups_id" |
|||
eval="[(4, ref('group_manually'))]"/> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
After Width: 128 | Height: 128 | Size: 9.2 KiB |
@ -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 |
@ -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) |
@ -0,0 +1,31 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- © 2016 Antiun Ingeniería S.L. - Jairo Llopis |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). --> |
|||
|
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="base_partner_merge_automatic_wizard_form" model="ir.ui.view"> |
|||
<field name="name">Restrict automatic merge access</field> |
|||
<field name="model">base.partner.merge.automatic.wizard</field> |
|||
<field |
|||
name="inherit_id" |
|||
ref="crm.base_partner_merge_automatic_wizard_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//button[@name='automatic_process_cb']" |
|||
position="attributes"> |
|||
<attribute name="groups"> |
|||
crm_deduplicate_acl.group_automatically |
|||
</attribute> |
|||
</xpath> |
|||
<xpath expr="//button[@name='update_all_process_cb']" |
|||
position="attributes"> |
|||
<attribute name="groups"> |
|||
crm_deduplicate_acl.group_automatically |
|||
</attribute> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue