Browse Source

Keyword arguments problem on merge partner (#128)

Closes #125
14.0
cubells 8 years ago
committed by Carlos Roca
parent
commit
e3298cea3a
  1. 20
      partner_deduplicate_acl/wizards/partner_merge.py

20
partner_deduplicate_acl/wizards/partner_merge.py

@ -3,19 +3,21 @@
# © 2016 Tecnativa, S.L. - Vicent Cubells # © 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 api, models
from openerp import SUPERUSER_ID, models
class BasePartnerMergeAutomaticWizard(models.TransientModel): class BasePartnerMergeAutomaticWizard(models.TransientModel):
_inherit = "base.partner.merge.automatic.wizard" _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( 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
) )
Loading…
Cancel
Save