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
changed to have displayStatus as separate column
aashu2e63cdb988a6
diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrdersTable.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrdersTable.tsxindex 3473f254bf..1371eac62e 100644--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrdersTable.tsx+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrdersTable.tsx@@ -154,38 +154,9 @@ const SalesOrdersTable = memo(({ data, count }: SalesOrdersTableProps) => {}},{- accessorKey: "status",+ accessorKey: "displayStatus",header: t`Status`,- cell: ({ row }) => {- const status =- row.getValue<(typeof salesOrderStatusType)[number]>("status");- const jobs = (row.original.jobs ?? []) as SalesOrderJob[];- const lines =- (row.original.lines as {- id: string;- saleQuantity: number;- methodType:- | "Purchase to Order"- | "Make to Order"- | "Pull from Inventory";- }[]) ?? [];- return (- <SalesStatus- status={status}- jobs={jobs.map((job) => ({- salesOrderLineId: job.salesOrderLineId,- productionQuantity: job.quantity,- quantityComplete: job.quantityComplete,- status: job.status- }))}- lines={lines.map((line) => ({- id: line.id,- methodType: line.methodType,- saleQuantity: line.saleQuantity- }))}- />- );- },+ cell: ({ row }) => <SalesStatus status={row.original.displayStatus} />,meta: {filter: {type: "static",diff --git a/packages/database/src/types.ts b/packages/database/src/types.tsindex 0ddacc00c7..64b77b39d1 100644--- a/packages/database/src/types.ts+++ b/packages/database/src/types.ts@@ -61106,6 +61106,7 @@ export type Database = {customerLocationId: string | nullcustomerReference: string | nullcustomFields: Json | null+ displayStatus: Database["public"]["Enums"]["salesOrderStatus"] | nulldropShipment: boolean | nullexchangeRate: number | nullexchangeRateUpdatedAt: string | nulldiff --git a/packages/database/supabase/migrations/20260618154832_sales-order-in-progress-filter.sql b/packages/database/supabase/migrations/20260618192741_sales-orders-view-display-status.sqlsimilarity index 74%rename from packages/database/supabase/migrations/20260618154832_sales-order-in-progress-filter.sqlrename to packages/database/supabase/migrations/20260618192741_sales-orders-view-display-status.sqlindex ede5ed8eac..073cc4413d 100644--- a/packages/database/supabase/migrations/20260618154832_sales-order-in-progress-filter.sql+++ b/packages/database/supabase/migrations/20260618192741_sales-orders-view-display-status.sql@@ -1,41 +1,14 @@--- Issue #448: make "In Progress" a real, filterable status on the salesOrders view.--- "In Progress" was previously only computed in SalesStatus.tsx, so the DB never--- had any row with that status and the filter could not match anything.--- This rewrites the view to override the forwarded s.status with a CASE expression--- that returns 'In Progress' when the order has any unfinished Make-to-Order line--- (and is not Closed/Cancelled), mirroring hasIncompleteJobs() in packages/utils.+-- Issue #448: expose a computed "displayStatus" column on the salesOrders view+-- so that filtering by "In Progress" returns orders that have at least one+-- unfinished Make-to-Order line. The raw "status" column is preserved so+-- filtering and sorting by the underlying enum (Confirmed, To Ship, etc.)+-- still works. The CASE mirrors hasIncompleteJobs() in+-- packages/utils/src/status.ts.DROP VIEW IF EXISTS "salesOrders";CREATE OR REPLACE VIEW "salesOrders" WITH(SECURITY_INVOKER=true) ASSELECT- s."id",- s."salesOrderId",- s."revisionId",- s."orderDate",- s."customerId",- s."customerLocationId",- s."customerContactId",- s."customerEngineeringContactId",- s."customerReference",- s."currencyCode",- s."exchangeRate",- s."exchangeRateUpdatedAt",- s."assignee",- s."salesPersonId",- s."opportunityId",- s."locationId",- s."companyId",- s."closedAt",- s."closedBy",- s."completedDate",- s."sentCompleteDate",- s."customFields",- s."internalNotes",- s."externalNotes",- s."createdAt",- s."createdBy",- s."updatedAt",- s."updatedBy",+ s.*,CASEWHEN s."status" NOT IN ('Closed', 'Cancelled')AND EXISTS (@@ -52,7 +25,7 @@ CREATE OR REPLACE VIEW "salesOrders" WITH(SECURITY_INVOKER=true) AS)THEN 'In Progress'::"salesOrderStatus"ELSE s."status"- END AS "status",+ END AS "displayStatus",sl."thumbnailPath",sl."itemType",sl."orderTotal" + COALESCE(ss."shippingCost", 0) AS "orderTotal",