From ab65a470a009d33558a7167dd2c3c649f785e686 Mon Sep 17 00:00:00 2001 From: Luca <102960244+Luca-Timo@users.noreply.github.com> Date: Mon, 15 Jun 2026 16:58:44 +0200 Subject: [PATCH] fix(accounting): tax report cost side queried a non-existent column MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tax-report cost query selected inbound_documents.description, but that column only exists on the 'expenses' table — inbound_documents has none. On Postgres this threw 'column inbound_documents.description does not exist', so the whole cost side failed with 'Costs could not be loaded'. Use inbound_documents.invoice_number (an existing column, same descriptor ledgerService surfaces) as the cost-row label instead. Expense rows still use their real expenses.description column. --- backend/src/services/taxReportService.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/src/services/taxReportService.js b/backend/src/services/taxReportService.js index f0592d2c..ffe20e39 100644 --- a/backend/src/services/taxReportService.js +++ b/backend/src/services/taxReportService.js @@ -233,7 +233,10 @@ async function loadCosts({ from, to, cur }) { 'inbound_documents.invoice_date', 'inbound_documents.created_at', 'inbound_documents.supplier_name', - 'inbound_documents.description', + // inbound_documents has no free-text `description` column (that lives on + // `expenses`); use the supplier invoice number as the row descriptor so + // the cost side aligns with the expense rows without a phantom column. + 'inbound_documents.invoice_number', 'inbound_documents.disposition', 'inbound_documents.tax_treatment', 'inbound_documents.status', @@ -254,7 +257,7 @@ async function loadCosts({ from, to, cur }) { source: 'incoming', date: r.invoice_date || r.created_at, supplierLabel: (r.supplier_name && String(r.supplier_name).trim()) || '', - description: r.description || '', + description: r.invoice_number || '', eventName: r.event_id ? (r.event_name || '') : '', disposition: r.disposition || '', taxTreatment: r.tax_treatment || 'domestic',