From 5149caebbfeb8f19b4cb8e9d388931e5f1b113cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Flod=C3=A9n?= Date: Mon, 6 Jul 2026 12:14:02 +0200 Subject: [PATCH] fix(transactions): use the resolved cash account name as bank line description (#899) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The booking dialog's bank line description was always the generic "bank_line_description" translation regardless of which cash account was actually resolved via resolveAccount(). This was accurate while the bank line was hardcoded to 1930, but now that the dialog resolves the real cash_account_id (#769) it can pick a different account whose own name should show up on the line instead. Signed-off-by: Jonas Flodén --- components/transactions/TransactionBookingDialog.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/transactions/TransactionBookingDialog.tsx b/components/transactions/TransactionBookingDialog.tsx index d91d1d9e..91686af1 100644 --- a/components/transactions/TransactionBookingDialog.tsx +++ b/components/transactions/TransactionBookingDialog.tsx @@ -117,10 +117,12 @@ export default function TransactionBookingDialog({ const [pickedInboxDocs, setPickedInboxDocs] = useState([]) const [inboxPickerOpen, setInboxPickerOpen] = useState(false) const [bankAccount, setBankAccount] = useState(null) + const [bankAccountName, setBankAccountName] = useState(null) useEffect(() => { if (!open || !transaction) return setBankAccount(null) + setBankAccountName(null) let cancelled = false fetch('/api/cash-accounts') .then((r) => { @@ -135,7 +137,12 @@ export default function TransactionBookingDialog({ transaction.cash_account_id ?? null, transaction.currency ?? 'SEK', ) + // Use the matched account's own name instead of a generic label. + const matched = + accounts.find((a) => a.id === transaction.cash_account_id) ?? + accounts.find((a) => a.ledger_account === account) setBankAccount(account) + setBankAccountName(matched?.name ?? null) }) .catch(() => { if (!cancelled) setBankAccount('1930') @@ -362,7 +369,7 @@ export default function TransactionBookingDialog({ initialLines={ preselectedTemplate ? buildInitialLinesFromTemplate(transaction, preselectedTemplate, bankAccount) - : buildInitialLines(transaction, t('bank_line_description'), bankAccount) + : buildInitialLines(transaction, bankAccountName ?? t('bank_line_description'), bankAccount) } initialDate={transaction.date} initialDescription={transaction.description}