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(inventory): scope receipt post lookups/updates by companyId

sidgaikwad573bcf007941
diff --git a/apps/erp/app/routes/x+/receipt+/$receiptId.post.tsx b/apps/erp/app/routes/x+/receipt+/$receiptId.post.tsx
index b766972559..b667650d3a 100644
--- a/apps/erp/app/routes/x+/receipt+/$receiptId.post.tsx
+++ b/apps/erp/app/routes/x+/receipt+/$receiptId.post.tsx
@@ -49,6 +49,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
.from("receipt")
.select("sourceDocument, status")
.eq("id", receiptId)
+ .eq("companyId", companyId)
.single();
// A voided receipt has already been reversed — re-posting would duplicate
@@ -168,7 +169,8 @@ export async function action({ request, params }: ActionFunctionArgs) {
.update({
status: "Pending"
})
- .eq("id", receiptId);
+ .eq("id", receiptId)
+ .eq("companyId", companyId);
if (setPendingState.error) {
throw redirect(