Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix: don't delete shipment lines on voided sales invoice

Brad Barbin24690b879293
diff --git a/packages/database/supabase/functions/post-sales-invoice/index.ts b/packages/database/supabase/functions/post-sales-invoice/index.ts
index e421aa01bf..9e179fe96b 100644
--- a/packages/database/supabase/functions/post-sales-invoice/index.ts
+++ b/packages/database/supabase/functions/post-sales-invoice/index.ts
@@ -988,11 +988,6 @@ serve(async (req: Request) => {
// Delete invoice-created shipments
if (invoiceShipments && invoiceShipments.length > 0) {
for (const shipment of invoiceShipments) {
- await trx
- .deleteFrom("shipmentLine")
- .where("shipmentId", "=", shipment.id)
- .execute();
-
await trx
.updateTable("shipment")
.set({