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
- removed slop
Gaurav Bhattfb1d228351f5
diff --git a/apps/erp/app/hooks/useCompanySettings.tsx b/apps/erp/app/hooks/useCompanySettings.tsxindex 18e4bf92a9..1e7f0cc5bf 100644--- a/apps/erp/app/hooks/useCompanySettings.tsx+++ b/apps/erp/app/hooks/useCompanySettings.tsx@@ -1,11 +1,6 @@import { useRouteData } from "@carbon/react";import { path } from "~/utils/path";-/**- * Companysettings shape exposed from the authenticated root loader. Returns- * undefined when called outside an authenticated route (e.g. share/public- * pages). Consumers should treat absent fields as their default.- */type CompanySettings = {showSupplierReadableId?: boolean | null;showCustomerReadableId?: boolean | null;diff --git a/packages/database/supabase/functions/import-csv/index.ts b/packages/database/supabase/functions/import-csv/index.tsindex 7d138aa1c0..3b665970a3 100644--- a/packages/database/supabase/functions/import-csv/index.ts+++ b/packages/database/supabase/functions/import-csv/index.ts@@ -42,8 +42,6 @@ const EXTERNAL_ID_KEY = "csv";* dropped, missing cells become "").*/function parsePermissiveCsv(text: string): Record<string, string>[] {- // Tokenize the full text into a 2D array of cells, respecting quoted fields- // that may span commas and newlines.const rows: string[][] = [];let row: string[] = [];let field = "";@@ -80,7 +78,6 @@ function parsePermissiveCsv(text: string): Record<string, string>[] {field += c;}}- // Trailing field / row (no terminating newline)if (field !== "" || row.length > 0) {row.push(field);if (row.length > 1 || (row.length === 1 && row[0] !== "")) {@@ -852,17 +849,14 @@ serve(async (req: Request) => {return record;});- // Determine which enum keys are missing from the first recordconst missingEnumKeys = Object.keys(enumMappings).filter((key) => !(key in mappedRecords[0]));if (missingEnumKeys.length > 0) {- // Add default values for missing enum keysmappedRecords = mappedRecords.map((record) => {const processedRecord = { ...record };- // Add default values for missing enum keysmissingEnumKeys.forEach((key) => {processedRecord[key] = enumMappings[key]["Default"];});@@ -1519,7 +1513,6 @@ serve(async (req: Request) => {.returning(["id", "readableId"]).execute();- // Create CSV mappings for newly inserted itemsawait upsertCsvMappings(trx,"item",@@ -1621,7 +1614,6 @@ serve(async (req: Request) => {});if (itemUpdates.length > 0) {- // Get current readableIds to detect changesconst currentItems = await trx.selectFrom("item").select(["id", "readableId"])@@ -1643,7 +1635,6 @@ serve(async (req: Request) => {.execute();}- // Update type-specific table id when readableId changesfor (const update of itemUpdates) {const oldReadableId = currentReadableIdMap.get(update.id);const newReadableId = update.data.readableId;diff --git a/packages/database/supabase/migrations/20260529120000_supplier-customer-readable-id-default.sql b/packages/database/supabase/migrations/20260529120000_supplier-customer-readable-id-default.sqlnew file mode 100644index 0000000000..3b76ad03a4--- /dev/null+++ b/packages/database/supabase/migrations/20260529120000_supplier-customer-readable-id-default.sql@@ -0,0 +1,7 @@+-- supplier.readableId and customer.readableId are filled by a BEFORE INSERT+-- trigger (see migration 20260521120000_supplier-customer-readable-id.sql),+-- so callers don't pass them. Adding DEFAULT '' makes Supabase's type+-- generator mark readableId as optional in the Insert type — the trigger+-- still overrides the empty default with the sequence value before commit.+ALTER TABLE "supplier" ALTER COLUMN "readableId" SET DEFAULT '';+ALTER TABLE "customer" ALTER COLUMN "readableId" SET DEFAULT '';