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: error message when placing order without supplier

Sidwebworks36250a945301
diff --git a/apps/erp/app/modules/purchasing/ui/Planning/PurchasingPlanningOrderDrawer.tsx b/apps/erp/app/modules/purchasing/ui/Planning/PurchasingPlanningOrderDrawer.tsx
index 31b3196195..876e5be4d2 100644
--- a/apps/erp/app/modules/purchasing/ui/Planning/PurchasingPlanningOrderDrawer.tsx
+++ b/apps/erp/app/modules/purchasing/ui/Planning/PurchasingPlanningOrderDrawer.tsx
@@ -735,7 +735,15 @@ export const PurchasingPlanningOrderDrawer = memo(
</Button>
<Button
variant="primary"
- onClick={() => onSubmit(selectedItem.id, orders)}
+ onClick={() => {
+ if (!selectedSupplier) {
+ toast.error(
+ "Cannot place order - no supplier associated with this item"
+ );
+ return;
+ }
+ onSubmit(selectedItem.id, orders);
+ }}
isDisabled={fetcher.state !== "idle"}
isLoading={fetcher.state !== "idle"}
>
diff --git a/apps/erp/app/modules/purchasing/ui/Planning/PurchasingPlanningTable.tsx b/apps/erp/app/modules/purchasing/ui/Planning/PurchasingPlanningTable.tsx
index a260ff3131..21799ddc8d 100644
--- a/apps/erp/app/modules/purchasing/ui/Planning/PurchasingPlanningTable.tsx
+++ b/apps/erp/app/modules/purchasing/ui/Planning/PurchasingPlanningTable.tsx
@@ -13,6 +13,7 @@ import {
Tooltip,
TooltipContent,
TooltipTrigger,
+ toast,
VStack
} from "@carbon/react";
import { getLocalTimeZone, parseDate } from "@internationalized/date";
@@ -140,9 +141,27 @@ const PlanningTable = memo(
// biome-ignore lint/correctness/useExhaustiveDependencies: suppressed due to migration
const onBulkUpdate = useCallback(
(selectedRows: typeof data, action: "order") => {
+ // Filter out rows without suppliers and track them for error reporting
+ const rowsWithoutSuppliers = selectedRows.filter(
+ (row) => row.id && !suppliersMap[row.id]
+ );
+ const rowsWithSuppliers = selectedRows.filter(
+ (row) => row.id && suppliersMap[row.id]
+ );
+
+ if (rowsWithoutSuppliers.length > 0) {
+ toast.error(
+ `Cannot place order - ${rowsWithoutSuppliers.length} item(s) have no supplier associated`
+ );
+ }
+
+ if (rowsWithSuppliers.length === 0) {
+ return;
+ }
+
const payload = {
locationId,
- items: selectedRows
+ items: rowsWithSuppliers
.filter((row) => row.id)
.map((row) => {
const ordersWithPeriods = (ordersMap[row.id!] || []).map(