From eeba9a1b9d0ce0b2f1564178b1462600270111cc Mon Sep 17 00:00:00 2001 From: cubells Date: Sat, 14 Jan 2017 12:02:33 +0100 Subject: [PATCH] Keyword arguments problem on merge partner (#128) Closes #125 --- partner_deduplicate_acl/README.rst | 5 +++-- partner_deduplicate_acl/__openerp__.py | 2 +- .../security/crm_deduplicate_acl_security.xml | 2 +- .../views/base_partner_merge_view.xml | 16 ++++++++------- .../wizards/partner_merge.py | 20 ++++++++++--------- 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/partner_deduplicate_acl/README.rst b/partner_deduplicate_acl/README.rst index 61c0be42e28..c924ca5da67 100644 --- a/partner_deduplicate_acl/README.rst +++ b/partner_deduplicate_acl/README.rst @@ -41,7 +41,7 @@ Usage To use this module, you need to: -#. Ask your admin to give you the new rigts. +#. Ask your admin to give you the new rights. #. Go to *Sales > Tools > Deduplicate Contacts* as usual. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas @@ -76,8 +76,9 @@ Contributors ------------ * Rafael Blasco -* Jairo Llopis +* Jairo Llopis * Vicent Cubells +* Pedro M. Baeza Maintainer ---------- diff --git a/partner_deduplicate_acl/__openerp__.py b/partner_deduplicate_acl/__openerp__.py index 6360af9add1..f4673ce4979 100644 --- a/partner_deduplicate_acl/__openerp__.py +++ b/partner_deduplicate_acl/__openerp__.py @@ -5,7 +5,7 @@ { "name": "Deduplicate Contacts ACL", "summary": "Contact deduplication with fine-grained permission control", - "version": "9.0.1.0.0", + "version": "9.0.1.1.0", "category": "Tools", "website": "http://www.tecnativa.com", "author": "Tecnativa, " diff --git a/partner_deduplicate_acl/security/crm_deduplicate_acl_security.xml b/partner_deduplicate_acl/security/crm_deduplicate_acl_security.xml index 7c0f0f87c05..40f6bcf2063 100644 --- a/partner_deduplicate_acl/security/crm_deduplicate_acl_security.xml +++ b/partner_deduplicate_acl/security/crm_deduplicate_acl_security.xml @@ -24,7 +24,7 @@ Without restrictions - + diff --git a/partner_deduplicate_acl/views/base_partner_merge_view.xml b/partner_deduplicate_acl/views/base_partner_merge_view.xml index 5173474eea9..bc0fea30f37 100644 --- a/partner_deduplicate_acl/views/base_partner_merge_view.xml +++ b/partner_deduplicate_acl/views/base_partner_merge_view.xml @@ -1,11 +1,13 @@ - - - + + diff --git a/partner_deduplicate_acl/wizards/partner_merge.py b/partner_deduplicate_acl/wizards/partner_merge.py index 1b89a1acaa9..4dd66656ac9 100644 --- a/partner_deduplicate_acl/wizards/partner_merge.py +++ b/partner_deduplicate_acl/wizards/partner_merge.py @@ -3,19 +3,21 @@ # © 2016 Tecnativa, S.L. - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import api, models +from openerp import SUPERUSER_ID, models class BasePartnerMergeAutomaticWizard(models.TransientModel): _inherit = "base.partner.merge.automatic.wizard" - @api.model - def _merge(self, partner_ids, dst_partner=None): - """Allow non-admins to merge partners with different emails.""" - # Know if user has unrestricted access - if self.env.user.has_group('crm_deduplicate_acl.group_unrestricted'): - # Run as admin if so - self = self.sudo() + def _merge(self, cr, uid, partner_ids, dst_partner=None, context=None): + """Allow non-admins to merge partners""" + + user = self.pool["res.users"].browse(cr, uid, uid, context=context) return super(BasePartnerMergeAutomaticWizard, self)._merge( - partner_ids=partner_ids, dst_partner=dst_partner + cr, + SUPERUSER_ID if user.has_group( + 'crm_deduplicate_acl.group_unrestricted') else uid, + partner_ids, + dst_partner=dst_partner, + context=context )