feat: import mostovik exchange sections
All checks were successful
CI/CD Pipeline / Run Tests (push) Successful in 6m12s
CI/CD Pipeline / Code Quality Checks (push) Successful in 6m19s
CI/CD Pipeline / Build Docker Images (push) Successful in 2m21s
CI/CD Pipeline / Push to Gitea Registry (push) Successful in 1s
CI/CD Pipeline / Deploy to Server (push) Successful in 1s

This commit is contained in:
2026-05-27 23:13:40 +02:00
parent bd8e1a8400
commit d1b0cd7945
49 changed files with 1831 additions and 319 deletions

View File

@@ -18,7 +18,8 @@ class FormF4RecordFactory(factory.django.DjangoModelFactory):
organization = factory.SubFactory(OrganizationFactory)
load_batch = factory.Sequence(lambda n: n + 1)
report_year = 2026
report_quarter = 1
report_half_year = 1
report_quarter = None
# Выручка
revenue_rsbu = factory.LazyAttribute(

View File

@@ -50,7 +50,7 @@ class FormF4ParserTest(TestCase):
def test_get_column_mappings_returns_mappings(self):
"""Test get_column_mappings returns correct mappings."""
parser = FormF4Parser(report_year=2026, report_quarter=1)
parser = FormF4Parser(report_year=2026, report_half_year=1)
mappings = parser.get_column_mappings()
self.assertIsInstance(mappings, list)
@@ -60,10 +60,11 @@ class FormF4ParserTest(TestCase):
self.assertIn("revenue_rsbu", field_names)
self.assertIn("net_profit_rsbu", field_names)
def test_create_record_creates_organization(self):
"""Test create_record creates organization if not exists."""
parser = FormF4Parser(report_year=2026, report_quarter=1)
def test_create_record_uses_existing_organization(self):
"""Report imports must attach rows only to preloaded Mostovik organizations."""
parser = FormF4Parser(report_year=2026, report_half_year=1)
parser.load_batch = 504
organization = OrganizationFactory.create(inn="4234567890")
row_data = {
"inn": "4234567890",
@@ -75,4 +76,7 @@ class FormF4ParserTest(TestCase):
record = parser.create_record(row_data)
self.assertIsNotNone(record)
self.assertEqual(record.organization.inn, "4234567890")
self.assertEqual(record.organization_id, organization.id)
self.assertEqual(record.report_half_year, 1)
self.assertIsNone(record.report_quarter)
self.assertEqual(record.report_period_display, "I полугодие 2026")