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.

feat: add auto-release option for made parts

Brad Barbin4ce939351500
diff --git a/apps/erp/app/modules/inventory/inventory.models.ts b/apps/erp/app/modules/inventory/inventory.models.ts
index 968d8e0346..a5f9261354 100644
--- a/apps/erp/app/modules/inventory/inventory.models.ts
+++ b/apps/erp/app/modules/inventory/inventory.models.ts
@@ -121,6 +121,7 @@ export const kanbanValidator = z.object({
id: zfd.text(z.string().optional()),
itemId: z.string().min(1, { message: "Item is required" }),
replenishmentSystem: z.enum(replenishmentSystemTypes).default("Buy"),
+ autoRelease: zfd.checkbox(),
quantity: zfd.numeric(
z.number().int().min(1, { message: "Quantity must be at least 1" })
),
diff --git a/apps/erp/app/modules/inventory/ui/Kanbans/KanbanForm.tsx b/apps/erp/app/modules/inventory/ui/Kanbans/KanbanForm.tsx
index 335f15b490..87c3a21e5a 100644
--- a/apps/erp/app/modules/inventory/ui/Kanbans/KanbanForm.tsx
+++ b/apps/erp/app/modules/inventory/ui/Kanbans/KanbanForm.tsx
@@ -1,5 +1,5 @@
import { useCarbon } from "@carbon/auth";
-import { SelectControlled, ValidatedForm } from "@carbon/form";
+import { Boolean, Hidden, SelectControlled, ValidatedForm } from "@carbon/form";
import {
Button,
Drawer,
@@ -45,7 +45,7 @@ const KanbanForm = ({ initialValues, onClose }: KanbanFormProps) => {
const [selectedReplenishmentSystem, setSelectedReplenishmentSystem] =
useState<string>(initialValues.replenishmentSystem || "Buy");
- const isEditing = Boolean(initialValues.id);
+ const isEditing = !!initialValues.id;
const [shelfId, setShelfId] = useState<string | null>(
initialValues.shelfId || null
@@ -180,11 +180,14 @@ const KanbanForm = ({ initialValues, onClose }: KanbanFormProps) => {
</DrawerDescription>
</DrawerHeader>
<DrawerBody>
+ {isEditing && <Hidden name="id" value={initialValues.id} />}
+ {selectedReplenishmentSystem === "Make" && (
+ <Hidden
+ name="purchaseUnitOfMeasureCode"
+ value={purchaseUnitOfMeasureCode}
+ />
+ )}
<VStack spacing={4}>
- {isEditing && (
- <input type="hidden" name="id" value={initialValues.id} />
- )}
-
<div className="grid grid-cols-1 gap-4 w-full">
<Item
name="itemId"
@@ -273,6 +276,18 @@ const KanbanForm = ({ initialValues, onClose }: KanbanFormProps) => {
if (value) setShelfId(value?.id ?? null);
}}
/>
+
+ {selectedReplenishmentSystem === "Make" && (
+ <Boolean
+ name="autoRelease"
+ label="Auto Release"
+ description={
+ selectedReplenishmentSystem === "Make"
+ ? "Automatically release the job when the kanban is scanned."
+ : undefined
+ }
+ />
+ )}
</div>
</VStack>
</DrawerBody>
diff --git a/apps/erp/app/modules/inventory/ui/Kanbans/KanbansTable.tsx b/apps/erp/app/modules/inventory/ui/Kanbans/KanbansTable.tsx
index 81b62967fa..0296b1e516 100644
--- a/apps/erp/app/modules/inventory/ui/Kanbans/KanbansTable.tsx
+++ b/apps/erp/app/modules/inventory/ui/Kanbans/KanbansTable.tsx
@@ -1,4 +1,5 @@
import {
+ Checkbox,
Combobox,
Copy,
DropdownMenuContent,
@@ -22,6 +23,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import {
LuCalendar,
+ LuCheck,
LuContainer,
LuHash,
LuLink,
@@ -215,7 +217,24 @@ const KanbansTable = memo(({ data, count, locationId }: KanbansTableProps) => {
icon: <LuMapPin />,
},
},
-
+ {
+ accessorKey: "autoRelease",
+ header: "Auto Release",
+ cell: ({ row }) =>
+ row.original.replenishmentSystem === "Make" ? (
+ <Checkbox isChecked={row.original.autoRelease ?? false} />
+ ) : null,
+ meta: {
+ icon: <LuCheck />,
+ filter: {
+ type: "static",
+ options: [
+ { value: "true", label: "Yes" },
+ { value: "false", label: "No" },
+ ],
+ },
+ },
+ },
{
accessorKey: "createdBy",
header: "Created By",
diff --git a/apps/erp/app/routes/x+/inventory+/kanbans.$id.tsx b/apps/erp/app/routes/x+/inventory+/kanbans.$id.tsx
index d9d14e6c02..3e9aee036d 100644
--- a/apps/erp/app/routes/x+/inventory+/kanbans.$id.tsx
+++ b/apps/erp/app/routes/x+/inventory+/kanbans.$id.tsx
@@ -78,6 +78,7 @@ export default function EditKanbanRoute() {
supplierId: kanban?.supplierId ?? "",
purchaseUnitOfMeasureCode: kanban?.purchaseUnitOfMeasureCode ?? "",
conversionFactor: kanban?.conversionFactor ?? 1,
+ autoRelease: kanban?.autoRelease ?? false,
};
return (
diff --git a/apps/erp/app/routes/x+/inventory+/kanbans.delete.$id.tsx b/apps/erp/app/routes/x+/inventory+/kanbans.delete.$id.tsx
index f6f17bbdcc..0f184178df 100644
--- a/apps/erp/app/routes/x+/inventory+/kanbans.delete.$id.tsx
+++ b/apps/erp/app/routes/x+/inventory+/kanbans.delete.$id.tsx
@@ -67,7 +67,7 @@ export default function DeleteKanbanRoute() {
return (
<ConfirmDelete
action={path.to.deleteKanban(id)}
- name={`Kanban for ${kanban.item?.name || kanban.itemId}`}
+ name={`Kanban for ${kanban.name || kanban.itemId}`}
text={`Are you sure you want to delete this kanban card? This cannot be undone.`}
onCancel={onCancel}
/>
diff --git a/apps/erp/app/routes/x+/inventory+/kanbans.new.tsx b/apps/erp/app/routes/x+/inventory+/kanbans.new.tsx
index f89a212a6a..092d3d2e80 100644
--- a/apps/erp/app/routes/x+/inventory+/kanbans.new.tsx
+++ b/apps/erp/app/routes/x+/inventory+/kanbans.new.tsx
@@ -65,6 +65,7 @@ export default function NewKanbanRoute() {
replenishmentSystem: "Buy" as const,
locationId,
conversionFactor: 1,
+ autoRelease: false,
};
return (
diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.ts
index c49b3b560b..1000c90986 100644
--- a/packages/database/src/swagger-docs-schema.ts
+++ b/packages/database/src/swagger-docs-schema.ts
@@ -14325,6 +14325,9 @@ export default {
{
$ref: "#/parameters/rowFilter.kanbans.conversionFactor",
},
+ {
+ $ref: "#/parameters/rowFilter.kanbans.autoRelease",
+ },
{
$ref: "#/parameters/rowFilter.kanbans.companyId",
},
@@ -14352,6 +14355,9 @@ export default {
{
$ref: "#/parameters/rowFilter.kanbans.shelfName",
},
+ {
+ $ref: "#/parameters/rowFilter.kanbans.supplierName",
+ },
{
$ref: "#/parameters/rowFilter.kanbans.thumbnailPath",
},
@@ -54843,6 +54849,9 @@ export default {
{
$ref: "#/parameters/rowFilter.kanban.conversionFactor",
},
+ {
+ $ref: "#/parameters/rowFilter.kanban.autoRelease",
+ },
{
$ref: "#/parameters/rowFilter.kanban.companyId",
},
@@ -54944,6 +54953,9 @@ export default {
{
$ref: "#/parameters/rowFilter.kanban.conversionFactor",
},
+ {
+ $ref: "#/parameters/rowFilter.kanban.autoRelease",
+ },
{
$ref: "#/parameters/rowFilter.kanban.companyId",
},
@@ -54999,6 +55011,9 @@ export default {
{
$ref: "#/parameters/rowFilter.kanban.conversionFactor",
},
+ {
+ $ref: "#/parameters/rowFilter.kanban.autoRelease",
+ },
{
$ref: "#/parameters/rowFilter.kanban.companyId",
},
@@ -67086,6 +67101,10 @@ export default {
format: "numeric",
type: "number",
},
+ autoRelease: {
+ format: "boolean",
+ type: "boolean",
+ },
companyId: {
description:
"Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",
@@ -67128,6 +67147,10 @@ export default {
format: "text",
type: "string",
},
+ supplierName: {
+ format: "text",
+ type: "string",
+ },
thumbnailPath: {
format: "text",
type: "string",
@@ -86106,6 +86129,7 @@ export default {
"quantity",
"locationId",
"conversionFactor",
+ "autoRelease",
"companyId",
"createdAt",
"createdBy",
@@ -86160,6 +86184,11 @@ export default {
format: "numeric",
type: "number",
},
+ autoRelease: {
+ default: false,
+ format: "boolean",
+ type: "boolean",
+ },
companyId: {
description:
"Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",
@@ -93890,6 +93919,12 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.kanbans.autoRelease": {
+ name: "autoRelease",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"rowFilter.kanbans.companyId": {
name: "companyId",
required: false,
@@ -93944,6 +93979,12 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.kanbans.supplierName": {
+ name: "supplierName",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"rowFilter.kanbans.thumbnailPath": {
name: "thumbnailPath",
required: false,
@@ -115385,6 +115426,12 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.kanban.autoRelease": {
+ name: "autoRelease",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"rowFilter.kanban.companyId": {
name: "companyId",
required: false,
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 18f6eddd1f..233a42424b 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -11629,6 +11629,7 @@ export type Database = {
}
kanban: {
Row: {
+ autoRelease: boolean
companyId: string
conversionFactor: number
createdAt: string
@@ -11645,6 +11646,7 @@ export type Database = {
updatedBy: string | null
}
Insert: {
+ autoRelease?: boolean
companyId: string
conversionFactor?: number
createdAt?: string
@@ -11661,6 +11663,7 @@ export type Database = {
updatedBy?: string | null
}
Update: {
+ autoRelease?: boolean
companyId?: string
conversionFactor?: number
createdAt?: string
@@ -39376,6 +39379,7 @@ export type Database = {
}
kanbans: {
Row: {
+ autoRelease: boolean | null
companyId: string | null
conversionFactor: number | null
createdAt: string | null
@@ -44915,14 +44919,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["paymentCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["paymentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 18f6eddd1f..233a42424b 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -11629,6 +11629,7 @@ export type Database = {
}
kanban: {
Row: {
+ autoRelease: boolean
companyId: string
conversionFactor: number
createdAt: string
@@ -11645,6 +11646,7 @@ export type Database = {
updatedBy: string | null
}
Insert: {
+ autoRelease?: boolean
companyId: string
conversionFactor?: number
createdAt?: string
@@ -11661,6 +11663,7 @@ export type Database = {
updatedBy?: string | null
}
Update: {
+ autoRelease?: boolean
companyId?: string
conversionFactor?: number
createdAt?: string
@@ -39376,6 +39379,7 @@ export type Database = {
}
kanbans: {
Row: {
+ autoRelease: boolean | null
companyId: string | null
conversionFactor: number | null
createdAt: string | null
@@ -44915,14 +44919,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["paymentCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["paymentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
diff --git a/packages/database/supabase/migrations/20250909012102_kanban.sql b/packages/database/supabase/migrations/20250909012102_kanban.sql
index f231f82b9d..55a6d813b7 100644
--- a/packages/database/supabase/migrations/20250909012102_kanban.sql
+++ b/packages/database/supabase/migrations/20250909012102_kanban.sql
@@ -8,6 +8,7 @@ CREATE TABLE "kanban" (
"supplierId" TEXT,
"purchaseUnitOfMeasureCode" TEXT,
"conversionFactor" NUMERIC NOT NULL DEFAULT 1,
+ "autoRelease" BOOLEAN NOT NULL DEFAULT FALSE,
"companyId" TEXT NOT NULL,
"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
"createdBy" TEXT NOT NULL,