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: validator enum values

Sidwebworksd83618a903f3
diff --git a/apps/erp/app/modules/invoicing/invoicing.models.ts b/apps/erp/app/modules/invoicing/invoicing.models.ts
index 74215e4ea8..c6f0079f5c 100644
--- a/apps/erp/app/modules/invoicing/invoicing.models.ts
+++ b/apps/erp/app/modules/invoicing/invoicing.models.ts
@@ -102,11 +102,14 @@ export const purchaseInvoiceLineValidator = z
.object({
id: zfd.text(z.string().optional()),
invoiceId: z.string().min(1, { message: "Invoice is required" }),
- invoiceLineType: z.enum([...methodItemType, "G/L Account", "Fixed Asset"], {
- errorMap: (issue, ctx) => ({
- message: "Type is required"
- })
- }),
+ invoiceLineType: z.enum(
+ [...methodItemType, "Service", "Fixture", "G/L Account", "Fixed Asset"],
+ {
+ errorMap: (issue, ctx) => ({
+ message: "Type is required"
+ })
+ }
+ ),
purchaseOrderId: zfd.text(z.string().optional()),
purchaseOrderLineId: zfd.text(z.string().optional()),
itemId: zfd.text(z.string().optional()),
@@ -221,11 +224,14 @@ export const salesInvoiceLineValidator = z
.object({
id: zfd.text(z.string().optional()),
invoiceId: z.string().min(1, { message: "Invoice is required" }),
- invoiceLineType: z.enum([...methodItemType, "Fixed Asset"], {
- errorMap: (issue, ctx) => ({
- message: "Type is required"
- })
- }),
+ invoiceLineType: z.enum(
+ [...methodItemType, "Service", "Fixture", "Fixed Asset"],
+ {
+ errorMap: (issue, ctx) => ({
+ message: "Type is required"
+ })
+ }
+ ),
methodType: z
.enum(methodType, {
errorMap: (issue, ctx) => ({
diff --git a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceHeader.tsx b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceHeader.tsx
index ef9ff96c39..8a792c19ce 100644
--- a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceHeader.tsx
+++ b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceHeader.tsx
@@ -160,7 +160,14 @@ const PurchaseInvoiceHeader = () => {
.from("purchaseInvoiceLine")
.select("itemId, description, quantity, conversionFactor")
.eq("invoiceId", invoiceId)
- .in("invoiceLineType", ["Part", "Material", "Tool", "Consumable"])
+ .in("invoiceLineType", [
+ "Part",
+ "Material",
+ "Tool",
+ "Consumable",
+ "Service",
+ "Fixture"
+ ])
.is("purchaseOrderLineId", null);
if (error) throw new Error(error.message);
diff --git a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm.tsx b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm.tsx
index db86f278be..37638d553c 100644
--- a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm.tsx
+++ b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm.tsx
@@ -302,6 +302,10 @@ const PurchaseInvoiceLineForm = ({
case "Material":
case "Part":
case "Tool":
+ // @ts-expect-error
+ case "Service":
+ // @ts-expect-error
+ case "Fixture":
const [item, supplierPart, inventory] = await Promise.all([
carbon
.from("item")
@@ -562,7 +566,9 @@ const PurchaseInvoiceLineForm = ({
"Part",
"Material",
"Tool",
- "Consumable"
+ "Consumable",
+ "Service",
+ "Fixture"
].includes(itemType) && (
<>
<NumberControlled
diff --git a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceHeader.tsx b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceHeader.tsx
index 8255a2bcf7..eb5775e87e 100644
--- a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceHeader.tsx
+++ b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceHeader.tsx
@@ -144,7 +144,14 @@ const SalesInvoiceHeader = () => {
.from("salesInvoiceLine")
.select("itemId, description, quantity")
.eq("invoiceId", invoiceId)
- .in("invoiceLineType", ["Part", "Material", "Tool", "Consumable"])
+ .in("invoiceLineType", [
+ "Part",
+ "Material",
+ "Tool",
+ "Consumable",
+ "Service",
+ "Fixture"
+ ])
.is("salesOrderLineId", null);
if (error) throw new Error(error.message);
diff --git a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceLineForm.tsx b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceLineForm.tsx
index 1b96cc8114..24d5d687af 100644
--- a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceLineForm.tsx
+++ b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceLineForm.tsx
@@ -252,6 +252,10 @@ const SalesInvoiceLineForm = ({
case "Material":
case "Part":
case "Tool":
+ // @ts-expect-error
+ case "Service":
+ // @ts-expect-error
+ case "Fixture":
const [item, inventory] = await Promise.all([
carbon
.from("item")
@@ -517,7 +521,9 @@ const SalesInvoiceLineForm = ({
"Part",
"Material",
"Tool",
- "Consumable"
+ "Consumable",
+ "Service",
+ "Fixture"
].includes(itemType) && (
<>
<div className="space-y-2">
@@ -603,7 +609,9 @@ const SalesInvoiceLineForm = ({
"Part",
"Material",
"Tool",
- "Consumable"
+ "Consumable",
+ "Service",
+ "Fixture"
].includes(itemType) && (
<div className="w-full">
<div className="w-full border border-border rounded-md shadow-sm p-4 flex flex-col gap-4 mt-4">
diff --git a/apps/erp/app/modules/purchasing/purchasing.models.ts b/apps/erp/app/modules/purchasing/purchasing.models.ts
index 057107a08f..b50a7842ce 100644
--- a/apps/erp/app/modules/purchasing/purchasing.models.ts
+++ b/apps/erp/app/modules/purchasing/purchasing.models.ts
@@ -208,7 +208,7 @@ export const purchaseOrderLineValidator = z
id: zfd.text(z.string().optional()),
purchaseOrderId: z.string().min(1, { message: "Order is required" }),
purchaseOrderLineType: z.enum(
- [...methodItemType, "G/L Account", "Fixed Asset"],
+ [...methodItemType, "Service", "Fixture", "G/L Account", "Fixed Asset"],
{
errorMap: (issue, ctx) => ({
message: "Type is required"
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsx
index 5873787dbb..97b718de3e 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsx
@@ -333,6 +333,10 @@ const PurchaseOrderLineForm = ({
case "Material":
case "Part":
case "Tool":
+ // @ts-expect-error
+ case "Service":
+ // @ts-expect-error
+ case "Fixture":
const [item, supplierPart, inventory] = await Promise.all([
carbon
.from("item")
@@ -646,7 +650,9 @@ const PurchaseOrderLineForm = ({
"Part",
"Material",
"Consumable",
- "Tool"
+ "Tool",
+ "Service",
+ "Fixture"
].includes(itemType) && (
<>
<UnitOfMeasure
@@ -699,7 +705,8 @@ const PurchaseOrderLineForm = ({
"Service",
"Material",
"Tool",
- "Consumable"
+ "Consumable",
+ "Fixture"
].includes(itemType) &&
!isOutsideProcessing && (
<Location
@@ -715,7 +722,8 @@ const PurchaseOrderLineForm = ({
"Service",
"Material",
"Tool",
- "Consumable"
+ "Consumable",
+ "Fixture"
].includes(itemType) &&
!isOutsideProcessing && (
<StorageUnit