feat: Transfer-Schlagwort mit festem Zielkonto (z. B. REVOLUT -> Konto Revolut)

- Transfer-Regel kann direkt ein Zielkonto tragen (target_account_id); ohne ->
  weiterhin Auto-Erkennung aus dem Buchungstext (Konto-Texte)
- Migration 0010; Endpunkt aktualisiert bestehendes Wort statt Konflikt
- Import bevorzugt das feste Zielkonto, sonst _guess_target_account
- Konten-Seite: Transfer-Erkennung mit Zielkonto-Auswahl + Anzeige am Chip
- Test: festes Zielkonto greift ohne Konto-Texte (75 grün)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Guido
2026-08-20 19:06:24 +02:00
co-authored by Claude Opus 4.8
parent 794a6aeb91
commit c44892ff72
9 changed files with 96 additions and 12 deletions
@@ -0,0 +1,31 @@
"""Transfer-Regeln: optionales festes Zielkonto.
Erlaubt, einem Transfer-Schlagwort direkt ein Zielkonto zuzuweisen (z. B.
„REVOLUT" -> Konto Revolut). Ohne Zielkonto wird es weiterhin aus dem
Buchungstext erraten.
Revision ID: 0010
Revises: 0009
Create Date: 2026-08-20
"""
from alembic import op
import sqlalchemy as sa
revision = "0010"
down_revision = "0009"
branch_labels = None
depends_on = None
def upgrade() -> None:
with op.batch_alter_table("categorization_rules") as batch:
batch.add_column(sa.Column("target_account_id", sa.Integer(), nullable=True))
batch.create_foreign_key(
"fk_rule_target_account", "accounts", ["target_account_id"], ["id"], ondelete="SET NULL"
)
def downgrade() -> None:
with op.batch_alter_table("categorization_rules") as batch:
batch.drop_constraint("fk_rule_target_account", type_="foreignkey")
batch.drop_column("target_account_id")