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.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
fix: get first location in the absence of a location
Brad Barbinf33b10fbaac7
diff --git a/apps/erp/app/routes/x+/schedule+/dates.tsx b/apps/erp/app/routes/x+/schedule+/dates.tsxindex d90086dad3..a068d3ae7f 100644--- a/apps/erp/app/routes/x+/schedule+/dates.tsx+++ b/apps/erp/app/routes/x+/schedule+/dates.tsx@@ -48,6 +48,7 @@ import type { Column, JobItem } from "~/modules/production/ui/Schedule";import type { DisplaySettings } from "~/modules/production/ui/Schedule/Kanban";import { DateKanban } from "~/modules/production/ui/Schedule/Kanban/DateKanban";import { ScheduleNavigation } from "~/modules/production/ui/Schedule/Kanban/ScheuleNavigation";+import { getLocationsList } from "~/modules/resources";import { getTagsList } from "~/modules/shared";import { getUserDefaults } from "~/modules/users/users.server";import { usePeople } from "~/stores";@@ -113,7 +114,7 @@ export async function loader({ request }: LoaderFunctionArgs) {const userDefaults = await getUserDefaults(client, userId, companyId);if (userDefaults.error) {throw redirect(- path.to.inventory,+ path.to.production,await flash(request,error(userDefaults.error, "Failed to load default location")@@ -124,6 +125,20 @@ export async function loader({ request }: LoaderFunctionArgs) {locationId = userDefaults.data?.locationId ?? null;}+ if (!locationId) {+ const locations = await getLocationsList(client, companyId);+ if (locations.error || !locations.data?.length) {+ throw redirect(+ path.to.production,+ await flash(+ request,+ error(locations.error, "Failed to load any locations")+ )+ );+ }+ locationId = locations.data?.[0].id as string;+ }+// Calculate date range based on viewlet startDate: string;let endDate: string;