fix(orders,delivery-notes): resolve build type errors after supplier removal

This commit is contained in:
Dave 2026-08-12 01:42:19 +02:00
parent 6344948b0b
commit 8856146023
2 changed files with 15 additions and 6 deletions

View file

@ -175,8 +175,7 @@ async function handlePrint(input: { deliveryNoteNumber: string; origin: string }
line: computePickingSlipLine({
id: it.id,
description: (it.description ?? "").trim() || "(no description)",
supplierName:
it.expand?.purchase_order?.expand?.supplier?.suppliername ?? "",
supplierName: "",
ordered,
collected,
pickQty,

View file

@ -1845,8 +1845,21 @@ export async function createOrder(input: CreateOrderInput): Promise<CreateOrderR
// Don't abort the whole order — record the patch failure on
// the per-row failure list. The row was created, just with
// defaults instead of the requested extras.
const failedDraft: {
description: string;
quantity: number | null;
cost_price: number;
markup: number;
selling_price: number;
} = {
description: original.description,
quantity: original.quantity ?? null,
cost_price: Number(original.cost_price ?? 0),
markup: Number(original.markup ?? 0),
selling_price: Number(original.selling_price ?? 0),
};
itemsResult.failed.push({
draft: original,
draft: failedDraft,
error: `Row created but secondary fields failed: ${
err instanceof Error ? err.message : String(err)
}`,
@ -1983,10 +1996,7 @@ export async function splitOrderForContinuation(
is_repair_order: parent.is_repair_order ?? false,
invoiced: false,
rep: parent.rep || "",
description: parent.description || "",
contact_name: parent.contact_name || "",
quote_reference_text: parent.quote_reference_text || "",
rfq_number: parent.rfq_number || "",
})) as Order;
// --- Clone items into the new order --------------------------------------