Browse Source

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.
pull/370/head
Jairo Llopis 8 years ago
committed by cubells
parent
commit
c53af38ca9
  1. 5
      partner_ref_unique/models/res_partner.py

5
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)
Loading…
Cancel
Save