feat: Import-Vorlage richtet sich nach dem gewaehlten Konto
Beim Kontowechsel musste man die Vorlage jedes Mal neu waehlen – und las im schlimmsten Fall den Revolut-Auszug mit der Raiffeisen-Vorlage ein (genau das steht im Verlauf). Eigene Vorlagen standen schon als template_id im Verlauf; Bank-Vorlagen sind fest im Code und hinterliessen nichts. Der Verlauf merkt sich deshalb jetzt auch deren Namen (Migration 0014). Die Oberflaeche waehlt beim Kontowechsel, womit zuletzt in dieses Konto importiert wurde. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -698,11 +698,12 @@ def _apply_counterpart_amount(db: Session, user: User, account: Account, row: di
|
||||
return True
|
||||
|
||||
|
||||
def commit_import(db: Session, user: User, account: Account, template_id: int | None, filename: str, rows: list[dict]) -> ImportBatch:
|
||||
def commit_import(db: Session, user: User, account: Account, template_id: int | None, filename: str,
|
||||
rows: list[dict], preset: str | None = None) -> ImportBatch:
|
||||
accounts = {a.id: a for a in db.query(Account).filter(Account.owner_id == user.id)}
|
||||
batch = ImportBatch(
|
||||
owner_id=user.id, account_id=account.id, template_id=template_id,
|
||||
filename=(filename or "")[:255], row_count=len(rows),
|
||||
preset=(preset or None), filename=(filename or "")[:255], row_count=len(rows),
|
||||
imported_count=0, status=ImportStatus.committed,
|
||||
)
|
||||
db.add(batch)
|
||||
|
||||
Reference in New Issue
Block a user