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/626/head
Jairo Llopis 9 years ago
committed by Cris Martín
parent
commit
06df2979cb
  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': if mode == 'companies':
domain.append(('is_company', '=', True)) domain.append(('is_company', '=', True))
other = self.search(domain) 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( raise ValidationError(
_("This reference is equal to partner '%s'") % _("This reference is equal to partner '%s'") %
other[0].display_name) other[0].display_name)
Loading…
Cancel
Save