From bcdd3d79bcc3fdfbd25174421098340e26fa5dbf Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Fri, 13 May 2016 18:36:57 +0200 Subject: [PATCH] Work with contact deduplicator. This contraint is self-disabled when it detects by context that it is being used from the contact deduplicator. Otherwise, the user cannot deduplicate a contact selecting the "good" one as the one without reference. Anyway, in these cases, the check has no meaning, since it is to avoid duplicates and in this context we are currently removing them. --- partner_ref_unique/models/res_partner.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/partner_ref_unique/models/res_partner.py b/partner_ref_unique/models/res_partner.py index 13b3284ef..fe76d9192 100644 --- a/partner_ref_unique/models/res_partner.py +++ b/partner_ref_unique/models/res_partner.py @@ -25,7 +25,10 @@ class ResPartner(models.Model): if mode == 'companies': domain.append(('is_company', '=', True)) other = self.search(domain) - if other: + + # active_test is False when called from + # base.partner.merge.automatic.wizard + if other and self.env.context.get("active_test", True): raise ValidationError( _("This reference is equal to partner '%s'") % other[0].display_name)