feat(recurring): carry dimension bags on recurring invoice schedules (#1272)

Schedules and their template items now store {sie_dim_no: code} bags
(default_dimensions / dimensions), and the cron generator copies them
onto every spawned invoice + item, so recurring invoices book with the
same projekt/kostnadsstalle tags a manual invoice would. Wired through
the web CRUD routes, the staged-operation executors, and the MCP
create/update/list schedule tools (resolve-don't-select, resolutions
echoed in the preview).

Migration 20260728090000 adds the two jsonb columns (same shape+CHECK
as invoices/invoice_items, PR7 producer parity).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-07-29 09:38:52 +02:00
committed by GitHub
co-authored by Claude Fable 5
parent 65c6d4c178
commit 951b33363b
12 changed files with 539 additions and 6 deletions
+7
View File
@@ -1242,6 +1242,10 @@ export interface RecurringInvoiceSchedule {
our_reference: string | null
notes: string | null
// Dimension bag {sie_dim_no: code} copied onto every generated invoice's
// default_dimensions at spawn time.
default_dimensions?: Record<string, string>
auto_send: boolean
status: RecurringInvoiceScheduleStatus
@@ -1269,6 +1273,9 @@ export interface RecurringInvoiceScheduleItem {
unit_price: number
// null = inherit customer's default VAT rate at spawn time
vat_rate: number | null
// Per-item bag copied onto the generated invoice_items.dimensions; merges
// over the schedule default on that item's revenue line.
dimensions?: Record<string, string>
created_at: string
}