fix(drafts): exclude drafts from VAT/revenue/created aggregations + koncept audit labels
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -127,13 +127,15 @@ export default async function invoicesRoutes(
|
||||
|
||||
const invoice = await createInvoice(body);
|
||||
|
||||
// A draft has no number yet — show "koncept" instead of "null".
|
||||
const isDraft = invoice.status === "draft";
|
||||
await logAudit({
|
||||
request,
|
||||
authData: request.authData,
|
||||
action: "create",
|
||||
entityType: "invoice",
|
||||
entityId: invoice.id,
|
||||
description: `Vytvořena faktura ${invoice.invoice_number}`,
|
||||
description: `Vytvořena faktura ${invoice.invoice_number ?? "koncept"}`,
|
||||
});
|
||||
// Return both invoice_id and id for frontend compatibility
|
||||
return success(
|
||||
@@ -144,7 +146,9 @@ export default async function invoicesRoutes(
|
||||
invoice_number: invoice.invoice_number,
|
||||
},
|
||||
201,
|
||||
"Faktura byla vystavena",
|
||||
isDraft
|
||||
? "Faktura byla uložena jako koncept"
|
||||
: "Faktura byla vystavena",
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user