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(items): BOM import wizard presets no unit of measure
Raul402f48a28821
diff --git a/.claude/rules/csv-import-system.md b/.claude/rules/csv-import-system.mdindex 98723009ff..6d1620d816 100644--- a/.claude/rules/csv-import-system.md+++ b/.claude/rules/csv-import-system.md@@ -282,7 +282,10 @@ continue.item, as `upsertMethodMaterial` does, and take the component's unit when thefile has none. A blank Operation Type takes the process's `processType` and ablank description the process's name, as BillOfProcess `onProcessChange`- fills them. Step descriptions go through `toTiptapDoc`, as the step form's+ fills them. The wizard presets no Default for the BOM Unit of Measure or the+ Operation Type (`fieldMappings` in `imports.models.ts`): an enum Default+ fills every blank and unmapped cell before the import runs, so a preset+ would replace these fallbacks. Step descriptions go through `toTiptapDoc`, as the step form'svalidator does. `customFields` is `{}` on lines and operations, as theroutes' `setCustomFields` writes it.`apps/erp/test/database/method-import-parity.test.ts` builds one methoddiff --git a/apps/erp/app/modules/shared/imports.models.ts b/apps/erp/app/modules/shared/imports.models.tsindex 79c54de890..445a3ce2fa 100644--- a/apps/erp/app/modules/shared/imports.models.ts+++ b/apps/erp/app/modules/shared/imports.models.ts@@ -334,9 +334,9 @@ const methodBomFields = {required: false,type: "enum",enumData: {- description: "The unit of measure of the component (default EA)",- fetcher: unitOfMeasureFetcher,- default: "EA"+ description:+ "The unit of measure of the component. Blank takes the component's own unit",+ fetcher: unitOfMeasureFetcher}},kit: {diff --git a/apps/erp/app/modules/shared/shared.method-import-append.test.ts b/apps/erp/app/modules/shared/shared.method-import-append.test.tsindex 5f883c26ee..328745c0c8 100644--- a/apps/erp/app/modules/shared/shared.method-import-append.test.ts+++ b/apps/erp/app/modules/shared/shared.method-import-append.test.ts@@ -8,6 +8,7 @@import { describe, expect, it } from "vitest";import { LOCKED_REVISION_MESSAGE } from "~/modules/items/items.service";+import { fieldMappings } from "./imports.models";import {methodImportRefusal,opKey,@@ -22,6 +23,23 @@ const method = (changeOrderId: string | null = null) => ({ id: `mm-${version}`, version, status, changeOrderId });+describe("wizard defaults", () => {+ // The wizard writes an enum's Default into every blank or unmapped cell, so+ // a preset here would replace the material's unit and the process's type.+ it("presets no BOM unit and no operation type", () => {+ for (const table of ["bom", "partWithMethod"] as const) {+ expect(+ fieldMappings[table].unitOfMeasureCode.enumData+ ).not.toHaveProperty("default");+ }+ for (const table of ["operations", "partWithMethod"] as const) {+ expect(fieldMappings[table].operationType.enumData).not.toHaveProperty(+ "default"+ );+ }+ });+});+describe("pickMethodImportTarget", () => {it("targets the highest non-archived version when the version is blank", () => {const methods = [