Browse Source

crm_deduplicate_acl

pull/721/head
cubells 8 years ago
committed by Pedro M. Baeza
parent
commit
5cf568bf47
  1. 10
      partner_deduplicate_acl/README.rst
  2. 3
      partner_deduplicate_acl/__init__.py
  3. 10
      partner_deduplicate_acl/__openerp__.py
  4. 75
      partner_deduplicate_acl/security/crm_deduplicate_acl_security.xml
  5. 3
      partner_deduplicate_acl/wizards/__init__.py
  6. 24
      partner_deduplicate_acl/wizards/partner_merge.py
  7. 10
      partner_deduplicate_acl/wizards/partner_merge_view.xml

10
partner_deduplicate_acl/README.rst

@ -46,7 +46,7 @@ To use this module, you need to:
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/111/8.0
:target: https://runbot.odoo-community.org/runbot/111/9.0
Known issues / Roadmap Known issues / Roadmap
====================== ======================
@ -60,11 +60,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues Bugs are tracked on `GitHub Issues
<https://github.com/OCA/crm/issues>`_. In case of trouble, please <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, 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**>`_.
help us smashing it by providing a detailed and welcomed feedback.
Credits Credits
======= =======
@ -72,6 +68,7 @@ Credits
Images Images
------ ------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
* `Arrow <https://openclipart.org/detail/131875/convergent>`_. * `Arrow <https://openclipart.org/detail/131875/convergent>`_.
* `Lock <http://fontawesome.io/icon/unlock-alt/>`_. * `Lock <http://fontawesome.io/icon/unlock-alt/>`_.
@ -80,6 +77,7 @@ Contributors
* Rafael Blasco <rafabn@antiun.com> * Rafael Blasco <rafabn@antiun.com>
* Jairo Llopis <yajo.sk8@gmail.com> * Jairo Llopis <yajo.sk8@gmail.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>
Maintainer Maintainer
---------- ----------

3
partner_deduplicate_acl/__init__.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2016 Antiun Ingeniería S.L. - Jairo Llopis
# © 2016 Tecnativa, S.L. - Jairo Llopis
# © 2016 Tecnativa, S.L. - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import wizards from . import wizards

10
partner_deduplicate_acl/__openerp__.py

@ -1,13 +1,15 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2016 Antiun Ingeniería S.L. - Jairo Llopis
# © 2016 Tecnativa, S.L. - Jairo Llopis
# © 2016 Tecnativa, S.L. - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{ {
"name": "Deduplicate Contacts ACL", "name": "Deduplicate Contacts ACL",
"summary": "Contact deduplication with fine-grained permission control", "summary": "Contact deduplication with fine-grained permission control",
"version": "8.0.1.0.0",
"version": "9.0.1.0.0",
"category": "Tools", "category": "Tools",
"website": "http://www.antiun.com",
"author": "Antiun Ingeniería S.L., Odoo Community Association (OCA)",
"website": "http://www.tecnativa.com",
"author": "Tecnativa, "
"Odoo Community Association (OCA)",
"license": "AGPL-3", "license": "AGPL-3",
"application": False, "application": False,
"installable": True, "installable": True,

75
partner_deduplicate_acl/security/crm_deduplicate_acl_security.xml

@ -1,44 +1,35 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- © 2016 Antiun Ingeniería S.L. - Jairo Llopis
<!-- © 2016 Tecnativa S.L. - Jairo Llopis
© 2016 Tecnativa S.L. - Vicent Cubells
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). --> 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>
<odoo>
<!-- 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>
</odoo>

3
partner_deduplicate_acl/wizards/__init__.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2016 Antiun Ingeniería S.L. - Jairo Llopis
# © 2016 Tecnativa, S.L. - Jairo Llopis
# © 2016 Tecnativa, S.L. - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import partner_merge from . import partner_merge

24
partner_deduplicate_acl/wizards/partner_merge.py

@ -1,25 +1,21 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2016 Antiun Ingeniería S.L. - Jairo Llopis
# © 2016 Tecnativa, S.L. - Jairo Llopis
# © 2016 Tecnativa, S.L. - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import SUPERUSER_ID, api, models
from openerp import api, models
class BasePartnerMergeAutomaticWizard(models.TransientModel): class BasePartnerMergeAutomaticWizard(models.TransientModel):
_inherit = "base.partner.merge.automatic.wizard" _inherit = "base.partner.merge.automatic.wizard"
@api.cr_uid_context
def _merge(self, cr, uid, partner_ids, dst_partner=None, context=None):
@api.model
def _merge(self, partner_ids, dst_partner=None):
"""Allow non-admins to merge partners with different emails.""" """Allow non-admins to merge partners with different emails."""
# Know if user has unrestricted access # 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
if self.env.user.has_group('crm_deduplicate_acl.group_unrestricted'):
# Run as admin if so
self = self.sudo()
return super(BasePartnerMergeAutomaticWizard, self)._merge( return super(BasePartnerMergeAutomaticWizard, self)._merge(
cr,
SUPERUSER_ID if group_unrestricted in user.groups_id else uid,
partner_ids,
dst_partner,
context)
partner_ids=partner_ids, dst_partner=dst_partner
)

10
partner_deduplicate_acl/wizards/partner_merge_view.xml

@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- © 2016 Antiun Ingeniería S.L. - Jairo Llopis
<!-- © 2016 Tecnativa S.L. - Jairo Llopis
© 2016 Tecnativa S.L. - Vicent Cubells
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). --> License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<openerp>
<data>
<odoo>
<record id="base_partner_merge_automatic_wizard_form" model="ir.ui.view"> <record id="base_partner_merge_automatic_wizard_form" model="ir.ui.view">
<field name="name">Restrict automatic merge access</field> <field name="name">Restrict automatic merge access</field>
@ -23,5 +22,4 @@
<field name="groups_id">group_manually</field> <field name="groups_id">group_manually</field>
</record> </record>
</data>
</openerp>
</odoo>
Loading…
Cancel
Save