|
@ -1,6 +1,6 @@ |
|
|
# Copyright 2016 Tecnativa - Jairo Llopis |
|
|
# Copyright 2016 Tecnativa - Jairo Llopis |
|
|
# Copyright 2016 Tecnativa - Vicent Cubells |
|
|
# Copyright 2016 Tecnativa - Vicent Cubells |
|
|
# Copyright 2017 Tecnativa - Pedro M. Baeza |
|
|
|
|
|
|
|
|
# Copyright 2017-2019 Tecnativa - Pedro M. Baeza |
|
|
# 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 odoo import models |
|
|
from odoo import models |
|
@ -9,19 +9,14 @@ from odoo import models |
|
|
class BasePartnerMergeAutomaticWizard(models.TransientModel): |
|
|
class BasePartnerMergeAutomaticWizard(models.TransientModel): |
|
|
_inherit = "base.partner.merge.automatic.wizard" |
|
|
_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. |
|
|
|
|
|
|
|
|
def _merge(self, partner_ids, dst_partner=None, extra_checks=True): |
|
|
|
|
|
"""Pass extra_checks=False if we have the extra group for avoiding |
|
|
|
|
|
the checks. |
|
|
""" |
|
|
""" |
|
|
if self.env.user.has_group('partner_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, |
|
|
|
|
|
|
|
|
if self.env.user.has_group( |
|
|
|
|
|
'partner_deduplicate_acl.group_unrestricted' |
|
|
|
|
|
): |
|
|
|
|
|
extra_checks = False |
|
|
|
|
|
return super()._merge( |
|
|
|
|
|
partner_ids, dst_partner=dst_partner, extra_checks=extra_checks, |
|
|
) |
|
|
) |