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: handle null shelf == undefined case for inventory adjustments

Brad Barbin673d35bd9f8f
diff --git a/apps/erp/app/modules/inventory/inventory.service.ts b/apps/erp/app/modules/inventory/inventory.service.ts
index 68c2235df3..ea5c5bbefe 100644
--- a/apps/erp/app/modules/inventory/inventory.service.ts
+++ b/apps/erp/app/modules/inventory/inventory.service.ts
@@ -553,7 +553,8 @@ export async function insertManualInventoryAdjustment(
);
const currentQuantity = shelfQuantities?.data?.find(
- (quantity) => quantity.shelfId === data.shelfId
+ // null == undefined - so we use a == instead of === here
+ (quantity) => quantity.shelfId == data.shelfId
);
const currentQuantityOnHand = currentQuantity?.quantity ?? 0;