feat: Konto-Saldo-Anker mit ankerbasierter Saldenrechnung

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-19 21:25:04 +02:00
parent 41d556bcde
commit f6a53b7e56
9 changed files with 297 additions and 47 deletions

View File

@@ -1,20 +1,21 @@
from datetime import date
from decimal import Decimal
from app.models.tables import Account, Category, RecurringItem, Statement, Transaction
from app.models.tables import Account, Category, RecurringItem, Transaction
from app.services.suggestions import suggest_recurring
H = {"Authorization": "Bearer test-key"}
def _seed_balance(db, amount="1000.00"):
# Portiert von Statement-closing-Logik auf Konto-Saldo-Anker (Ausbaustufe 3
# Task 1): der Anker am Konto uebernimmt die Rolle der frueheren
# Statement.closing_balance als Saldo-Basis.
acc = Account(bank="dkb", iban="DE01", name="G", type="giro")
db.add(acc)
db.flush()
db.add(Statement(filename="s.pdf", bank="dkb", account_id=acc.id,
period_start=date(2026, 6, 1), period_end=date(2026, 6, 30),
opening_balance=Decimal("0"), closing_balance=Decimal(amount),
status="confirmed"))
acc.anchor_date = date(2026, 6, 30)
acc.anchor_balance = Decimal(amount)
db.commit()