feat(expenses): repay utlägg from the bank line (#2333)
* feat(expenses): repay utlägg from the bank line
The transfer that repays a person's registered utlägg is now booked from
the bank inbox (or one click on Hem) instead of ahead of it: the payout RPC
takes the unbooked bank transaction, requires an SEK outflow equal to the
claims' total to the öre, posts liability D / 19xx K, marks the claims paid
and links the row in one locked transaction. The same transfer can no
longer be booked twice (once by "Betala ut", once by categorising the row).
- create_expense_payout_batch(..., p_transaction_id): old signature dropped
so a 6-argument call cannot become ambiguous; refusals TX_NOT_FOUND,
TX_ALREADY_BOOKED, TX_CURRENCY, TX_AMOUNT_MISMATCH
- POST /api/transactions/[id]/match-expense-payout { claim_ids }
- lib/expenses/expense-payout-candidates: pure per-person grouping and
outflow pairing (one person per amount; shared totals are skipped)
- Hem suggested matches gain kind 'expense_payout'; the inbox row gets a
primary "Bokför återbetalning av utlägg till {name}" and a two-leg confirm
- PAYOUT_ERROR_MESSAGES shared by both payout routes
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8YsvPqjfGxGZUkGeBVUWQ
* feat(expenses): close the utlägg gaps: claim picker, foreign VAT, enskild firma
- "Matcha mot utlägg" in the inbox row menu: pick the person and the
receipts a transfer covers when the exact-amount pairing missed it. The
picked sum must equal the row to the öre; the same RPC books it.
- A foreign receipt defaults VAT to 0 in the Underlag dialog with a note:
foreign VAT is not deductible on 2641.
- Enskild firma: a claim on 2018 is egen insättning, not a debt. Excluded
from Att göra, the attention resource, suggestions and the picker; a
payout for it debits 2013 (eget uttag), never 2018. Copy in the pane and
the dialog says so.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8YsvPqjfGxGZUkGeBVUWQ
---------
Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
Jakob Wennberg
parent
238cbe13f9
commit
b71f2bf425
@@ -995,6 +995,26 @@ const INVOICE: Record<string, StructuredErrorEntry> = {
|
||||
message_en:
|
||||
'The payout was booked but the transaction could not be linked to the voucher. Link it via "Match against existing voucher".',
|
||||
},
|
||||
EXPENSE_PAYOUT_MATCH_NOT_EXPENSE: {
|
||||
httpStatus: 400,
|
||||
message_sv: 'Endast utbetalningar kan matchas mot utlägg.',
|
||||
message_en: 'Only outgoing transactions can be matched to expense claims.',
|
||||
},
|
||||
EXPENSE_PAYOUT_MATCH_TX_ALREADY_LINKED: {
|
||||
httpStatus: 400,
|
||||
message_sv: 'Transaktionen är redan bokförd eller kopplad till en verifikation.',
|
||||
message_en: 'The transaction is already booked or linked to a journal entry.',
|
||||
},
|
||||
EXPENSE_PAYOUT_MATCH_CURRENCY: {
|
||||
httpStatus: 400,
|
||||
message_sv: 'Utlägg betalas ut i SEK och transaktionen har en annan valuta.',
|
||||
message_en: 'Expense claims are reimbursed in SEK; the transaction is in another currency.',
|
||||
},
|
||||
EXPENSE_PAYOUT_MATCH_AMOUNT: {
|
||||
httpStatus: 400,
|
||||
message_sv: 'Beloppet stämmer inte med de valda utläggen. Välj de utlägg som överföringen täcker.',
|
||||
message_en: 'The amount does not match the selected expense claims. Pick the claims this transfer covers.',
|
||||
},
|
||||
ROT_RUT_FILE_CREATE_FAILED: {
|
||||
httpStatus: 500,
|
||||
message_sv: 'Filen kunde inte skapas.',
|
||||
|
||||
Reference in New Issue
Block a user