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): accept picked return entities without a readableId in batch receipt validation

aashu5099a0ad8e5d
diff --git a/apps/erp/app/modules/inventory/ui/Receipts/ReceiptPostModal.tsx b/apps/erp/app/modules/inventory/ui/Receipts/ReceiptPostModal.tsx
index 4ce36a1bb5..ef5e06bb78 100644
--- a/apps/erp/app/modules/inventory/ui/Receipts/ReceiptPostModal.tsx
+++ b/apps/erp/app/modules/inventory/ui/Receipts/ReceiptPostModal.tsx
@@ -104,7 +104,13 @@ const ReceiptPostModal = ({ onClose }: { onClose: () => void }) => {
return attributes["Receipt Line"] === line.id;
});
- if (!trackedEntity?.readableId) {
+ // A sales-return receipt picks an existing entity (ReturnEntityForm) —
+ // the entity itself is the batch, so it counts even without a
+ // readableId (mirrors the serial branch below).
+ const isSalesReturn =
+ routeData?.receipt?.sourceDocument === "Sales Return Order";
+
+ if (isSalesReturn ? !trackedEntity : !trackedEntity?.readableId) {
errors.push({
itemReadableId: getItemReadableId(items, line.itemId) ?? null,
receivedQuantity: line.receivedQuantity ?? 0,