fix: copy organization dependency to exchange target
This commit is contained in:
@@ -497,7 +497,7 @@ class ExchangeConnectionService:
|
|||||||
if not cls._requires_registry_organizations(models_to_copy):
|
if not cls._requires_registry_organizations(models_to_copy):
|
||||||
return models_to_copy
|
return models_to_copy
|
||||||
|
|
||||||
organization_model = django_apps.get_model("registers.Organization")
|
organization_model = django_apps.get_model("organizations.Organization")
|
||||||
ordered_models = [organization_model, *models_to_copy]
|
ordered_models = [organization_model, *models_to_copy]
|
||||||
|
|
||||||
unique_models = []
|
unique_models = []
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ from contextlib import suppress
|
|||||||
from apps.exchange.models import ExchangeConnection
|
from apps.exchange.models import ExchangeConnection
|
||||||
from apps.exchange.services import ExchangeConnectionService
|
from apps.exchange.services import ExchangeConnectionService
|
||||||
from apps.parsers.models import IndustrialCertificateRecord, ParserLoadLog
|
from apps.parsers.models import IndustrialCertificateRecord, ParserLoadLog
|
||||||
from apps.registers.models import Organization
|
|
||||||
from django.db import connections
|
from django.db import connections
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
from organizations.models import Organization
|
||||||
|
|
||||||
|
|
||||||
class ExchangeConnectionServiceDependenciesTest(TestCase):
|
class ExchangeConnectionServiceDependenciesTest(TestCase):
|
||||||
@@ -20,7 +20,7 @@ class ExchangeConnectionServiceDependenciesTest(TestCase):
|
|||||||
|
|
||||||
self.assertEqual(models_to_copy, [ParserLoadLog])
|
self.assertEqual(models_to_copy, [ParserLoadLog])
|
||||||
|
|
||||||
def test_extend_models_adds_registers_organization_first(self):
|
def test_extend_models_adds_fk_target_organization_first(self):
|
||||||
models_to_copy = ExchangeConnectionService._extend_models_with_dependencies(
|
models_to_copy = ExchangeConnectionService._extend_models_with_dependencies(
|
||||||
[IndustrialCertificateRecord]
|
[IndustrialCertificateRecord]
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user