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: update shipments on invoice complete

Brad Barbin45fb25570b75
diff --git a/packages/database/supabase/functions/post-sales-invoice/index.ts b/packages/database/supabase/functions/post-sales-invoice/index.ts
index 3d143908a8..92cecb164d 100644
--- a/packages/database/supabase/functions/post-sales-invoice/index.ts
+++ b/packages/database/supabase/functions/post-sales-invoice/index.ts
@@ -637,6 +637,16 @@ serve(async (req: Request) => {
status = "To Invoice";
}
+ if (areAllLinesInvoiced) {
+ await trx
+ .updateTable("shipment")
+ .set({
+ invoiced: true,
+ })
+ .where("sourceDocumentId", "=", salesOrderId)
+ .execute();
+ }
+
await trx
.updateTable("salesOrder")
.set({