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
Merge branch 'main' into feat/quote-bulk-import
sidgaikwad0c7accf82f08
diff --cc apps/erp/app/routes/x+/shared+/import.$tableId.tsxindex 2a9bd552ad,fc2b6fb7eb..6d69f4345d--- a/apps/erp/app/routes/x+/shared+/import.$tableId.tsx+++ b/apps/erp/app/routes/x+/shared+/import.$tableId.tsx@@@ -44,45 -36,16 +44,45 @@@ export async function action({ request}const { filePath, enumMappings, ...columnMappings } = validation.data;+ let parsedEnumMappings: Record<string, Record<string, string>> | undefined;+ if (enumMappings) {+ try {+ parsedEnumMappings = JSON.parse(enumMappings as string);+ } catch {+ // Malformed client-supplied JSON — treat as a validation failure rather+ // than letting the parse throw escape as a 500.+ return {+ success: false,+ message: "Validation failed"+ };+ }+ }const serviceRole = getCarbonServiceRole();- const importResult = await importCsv(serviceRole, {- table,- filePath: filePath as string,- columnMappings: columnMappings as Record<string, string>,- enumMappings: enumMappings ? JSON.parse(enumMappings as string) : undefined,- companyId,- userId- });+ // Quotes are created through the sales services (Option B) so quote side+ // effects — opportunity, payment, shipment, external link — are preserved;+ // all other tables run through the generic import-csv edge function.+ const importResult = isQuoteImportTable(table)+ ? await importQuotes(serviceRole, {+ db: getDatabaseClient(),+ table,+ filePath: filePath as string,+ columnMappings: columnMappings as Record<string, string>,+ enumMappings: parsedEnumMappings,+ companyId,+ companyGroupId,+ userId+ })+ : await importCsv(serviceRole, {+ table,+ filePath: filePath as string,- columnMappings,++ columnMappings: columnMappings as Record<string, string>,+ // The edge-fn wrapper types enumMappings loosely (Record<string,+ // string[]>); the real payload is field → { value → mapped }.+ enumMappings: parsedEnumMappings as unknown as Record<string, string[]>,+ companyId,+ userId+ });if (importResult.error) {return {