Before this commit, the partner_ref_unique could be changed on the
company even if existing partners share the same internal ref.
Therefore, errors will appear afterwards as DB already contains
duplicates although the policy shouldn't allow it.
With this change, the error will appear as soon as the policy is
changed, so that the data must be fixed before activating the
constraint.
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.