fix(inbox): carry the matched transaction amount into manual booking (#1546)

PR #1524 swapped the matched-state "Bokfor manuellt" path from
BookDirectlyDialog to EditKonteringDialog, which is seeded only from the
booking proposal. An unknown supplier has no proposal, so the dialog
opened with two blank rows and no amount at all: on a foreign-currency
invoice the SEK figure then existed nowhere on screen (user-reported
regression, 2026-08-12).

suggest-booking now returns, on every empty-proposal branch (no_mapping,
currency_unsupported, engine failure), the matched bank row's SEK amount
and date plus a balanced two-row skeleton: the settlement account on one
side, a blank cost row on the other, mirroring what buildPrefillLines
seeded before the swap. The SEK amount goes through
resolveSekAmountOrNull, so a foreign row with no honest kronor figure
still opens blank rather than relabeling EUR as SEK. The dialog also
shows the matched transaction's amount and date beside the title, and
empty proposals now carry the bank date so the entry no longer falls
back to the document date.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Mattsson
2026-08-13 00:45:46 +02:00
committed by GitHub
co-authored by Claude Fable 5
parent a97b0023d4
commit 402bf02b1b
8 changed files with 270 additions and 6 deletions
@@ -2523,6 +2523,13 @@ type SuggestedBooking = {
description?: string
rule_name?: string | null
entry_date?: string
/** Skeleton rows seeded from the matched bank transaction when `lines` is
empty: the amount in SEK against the settlement account, cost side left
blank. Editor prefill only; never rendered as a proposal. */
fallback_lines?: { account_number: string; debit_amount: number; credit_amount: number; description: string }[]
/** The matched bank row's SEK amount and date, present on empty proposals
so the dialog can still show the kronor figure. */
transaction?: { amount_sek: number; date: string } | null
}
const SUGGESTION_SOURCE_LABEL: Record<string, string> = {
@@ -3231,7 +3238,12 @@ function FieldsRail({
new Date().toISOString().slice(0, 10)
}
description={data?.supplier?.name ?? item.email_subject ?? 'Underlag'}
lines={proposal?.lines ?? []}
// No proposal is not the same as no amount: the matched bank row still
// knows what left the account and where. The fallback skeleton keeps
// the kronor figure in the form (regression report 2026-08-12: match,
// "Bokför manuellt", and the amount no longer followed along).
lines={proposal?.lines.length ? proposal.lines : (proposal?.fallback_lines ?? [])}
matchedTransaction={proposal?.transaction ?? null}
onBooked={() => {
setEditOpen(false)
// Realtime refreshes the list, but this rail renders from the