You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
1.0 KiB
27 lines
1.0 KiB
# Copyright 2016 Tecnativa - Jairo Llopis
|
|
# Copyright 2016 Tecnativa - Vicent Cubells
|
|
# Copyright 2017 Tecnativa - Pedro M. Baeza
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|
|
|
from odoo import models
|
|
|
|
|
|
class BasePartnerMergeAutomaticWizard(models.TransientModel):
|
|
_inherit = "base.partner.merge.automatic.wizard"
|
|
|
|
def _merge(self, partner_ids, dst_partner=None):
|
|
"""Perform the operation as admin if you have unrestricted merge
|
|
rights to avoid the rise of exceptions. An special context key is
|
|
passed for preserving the message author.
|
|
"""
|
|
if self.env.user.has_group('crm_deduplicate_acl.group_unrestricted'):
|
|
obj = self.sudo().with_context(message_post_user=self.env.uid)
|
|
if dst_partner:
|
|
dst_partner = dst_partner.with_context(
|
|
message_post_user=self.env.uid,
|
|
)
|
|
else:
|
|
obj = self
|
|
return super(BasePartnerMergeAutomaticWizard, obj)._merge(
|
|
partner_ids, dst_partner=dst_partner,
|
|
)
|