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: method type in paperless integration

Brad Barbine7f352bc7b8f
diff --git a/packages/database/supabase/migrations/20260403000000_paperless-parts-method-type-fix.sql b/packages/database/supabase/migrations/20260403000000_paperless-parts-method-type-fix.sql
new file mode 100644
index 0000000000..6ae5252c07
--- /dev/null
+++ b/packages/database/supabase/migrations/20260403000000_paperless-parts-method-type-fix.sql
@@ -0,0 +1,9 @@
+UPDATE "companyIntegration"
+SET "metadata" = ("metadata"::jsonb || '{"methodType": "Purchase to Order"}'::jsonb)::json
+WHERE "id" = 'paperless-parts'
+ AND "metadata"::jsonb->>'methodType' = 'Buy';
+
+UPDATE "companyIntegration"
+SET "metadata" = ("metadata"::jsonb || '{"methodType": "Pull from Inventory"}'::jsonb)::json
+WHERE "id" = 'paperless-parts'
+ AND "metadata"::jsonb->>'methodType' = 'Pick';
diff --git a/packages/ee/src/paperless-parts/config.tsx b/packages/ee/src/paperless-parts/config.tsx
index 1bb714e75d..23b55490f3 100644
--- a/packages/ee/src/paperless-parts/config.tsx
+++ b/packages/ee/src/paperless-parts/config.tsx
@@ -36,9 +36,9 @@ export const PaperlessParts = defineIntegration({
name: "methodType",
label: "Material Method Type",
type: "options",
- listOptions: ["Buy", "Pick"],
+ listOptions: ["Purchase to Order", "Pull from Inventory"],
required: false,
- value: "Pick"
+ value: "Pull from Inventory"
},
{
name: "trackingType",
diff --git a/packages/ee/src/paperless-parts/lib/lib.ts b/packages/ee/src/paperless-parts/lib/lib.ts
index 20cf72cd99..a5b523e591 100644
--- a/packages/ee/src/paperless-parts/lib/lib.ts
+++ b/packages/ee/src/paperless-parts/lib/lib.ts
@@ -2930,14 +2930,16 @@ export async function insertQuoteLines(
(component as any).obtain_method === "purchased" ||
component.type === "purchased" ||
component.process?.name === "Purchased Components";
- const rootMethodType = isPurchased ? "Buy" : "Make";
+ const rootMethodType = isPurchased
+ ? "Purchase to Order"
+ : "Make to Order";
// Insert quote line
const quoteLine: Database["public"]["Tables"]["quoteLine"]["Insert"] = {
quoteId,
itemId,
description: component.description || component.part_name || "",
- methodType: rootMethodType as "Make to Order" | "Purchase to Order",
+ methodType: rootMethodType,
quantity: quantities.length > 0 ? quantities : null,
unitOfMeasureCode: "EA",
status: "Not Started",
@@ -2995,7 +2997,7 @@ export async function insertQuoteLines(
}
// For Make items, get the auto-created quoteMakeMethod and add materials/operations
- if (rootMethodType === "Make") {
+ if (rootMethodType === "Make to Order") {
const makeMethodResult = await carbon
.from("quoteMakeMethod")
.select("id")
@@ -3171,10 +3173,10 @@ export async function insertQuoteLines(
const childMethodType =
(childComponent as any)?.obtain_method === "purchased" ||
(childComponent as any)?.type === "purchased"
- ? "Buy"
- : "Make";
+ ? "Purchase to Order"
+ : "Make to Order";
- if (childMethodType === "Make") {
+ if (childMethodType === "Make to Order") {
madeChildren.push({
childRef,
childComponent,