feat: add KS-3/payments, tech debt fixes, UI polish, and KS-2 Excel/Word export

Tasks 008-016: KS-6a journal, KS-3 documents, payments with allocations,
tech debt cleanup, financial privacy, document tree, storno mechanism,
row-click UI, BOQ collapse/sticky header, and KS-2 export to Excel/Word
via shared DTO architecture.
This commit is contained in:
Арсентьев Александр
2026-09-27 13:38:45 +03:00
parent 6c608a8779
commit 9cfb341774
57 changed files with 7163 additions and 50 deletions
+8
View File
@@ -8,6 +8,7 @@ ITEM_WORK_ITEM_MIGRATION = "20260925_agreement_item_work_item_required"
WORK_ITEM_OPTIONAL_BOQ_MIGRATION = "20260925_work_item_optional_boq"
DAILY_REPORT_OPTIONAL_SYSTEM_MIGRATION = "20260925_daily_report_optional_system"
KS2_REPORTING_PERIOD_MIGRATION = "20260925_ks2_reporting_period"
PAYMENT_STATUS_MIGRATION = "20260926_payment_status"
def run_migrations(engine):
@@ -178,6 +179,13 @@ def run_migrations(engine):
connection.execute("ALTER TABLE ks2_documents ADD COLUMN reporting_period_to DATE")
connection.execute("INSERT INTO schema_migrations(version, applied_at) VALUES (?, ?)",
(KS2_REPORTING_PERIOD_MIGRATION, datetime.now(timezone.utc).isoformat()))
if PAYMENT_STATUS_MIGRATION not in applied:
payment_cols = {row[1] for row in connection.execute("PRAGMA table_info(payments)")}
if "status" not in payment_cols:
connection.execute("ALTER TABLE payments ADD COLUMN status VARCHAR NOT NULL DEFAULT 'active'")
connection.execute("CREATE INDEX IF NOT EXISTS ix_payments_status ON payments (status)")
connection.execute("INSERT INTO schema_migrations(version, applied_at) VALUES (?, ?)",
(PAYMENT_STATUS_MIGRATION, datetime.now(timezone.utc).isoformat()))
violations = connection.execute("PRAGMA foreign_key_check").fetchall()
if violations:
raise RuntimeError(f"Foreign key violations after agreement migration: {violations[:10]}")