fix: keep organization identity types exclusive
All checks were successful
CI/CD Pipeline / Quality Gate (push) Successful in 35s
CI/CD Pipeline / Build and Push Images (push) Successful in 19s
CI/CD Pipeline / Internal Notify (push) Successful in 0s
CI/CD Pipeline / Deploy Dev in Dokploy (push) Successful in 1s

This commit is contained in:
2026-05-20 12:45:06 +02:00
parent 8dabfe9cdf
commit 76a99a4a1e
3 changed files with 59 additions and 7 deletions

View File

@@ -519,13 +519,17 @@ class OrganizationSourceIngestionService:
if not organization.inn and safe_inn == record.inn:
organization.inn = record.inn
changed = True
if not organization.kpp and record.kpp:
has_entrepreneur_identity = bool(organization.ogrip or record.ogrip)
has_legal_identity = bool(
organization.kpp or organization.ogrn or record.kpp or record.ogrn
)
if not organization.kpp and record.kpp and not has_entrepreneur_identity:
organization.kpp = record.kpp
changed = True
if not organization.ogrn and record.ogrn:
if not organization.ogrn and record.ogrn and not has_entrepreneur_identity:
organization.ogrn = record.ogrn
changed = True
if not organization.ogrip and record.ogrip:
if not organization.ogrip and record.ogrip and not has_legal_identity:
organization.ogrip = record.ogrip
changed = True
if cls._should_replace_placeholder_name(organization, record.organization_name):