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
feat: provide helpful error message when insert customer part fails due to uniqueness constraint
Rob Carringtondea2a94ec861
diff --git a/apps/carbon/app/routes/x+/part+/$itemId.sales.customer-parts.delete.$customerPartToItemId.tsx b/apps/carbon/app/routes/x+/part+/$itemId.sales.customer-parts.delete.$customerPartToItemId.tsxindex ca74cfa8d8..6516e7f839 100644--- a/apps/carbon/app/routes/x+/part+/$itemId.sales.customer-parts.delete.$customerPartToItemId.tsx+++ b/apps/carbon/app/routes/x+/part+/$itemId.sales.customer-parts.delete.$customerPartToItemId.tsx@@ -66,7 +66,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}-export default function DeletePurchaseOrderLineRoute() {+export default function DeleteCustomerPartRoute() {const { itemId, customerPartToItemId } = useParams();const { customerPart } = useLoaderData<typeof loader>();const navigate = useNavigate();diff --git a/apps/carbon/app/routes/x+/part+/$itemId.sales.customer-parts.new.tsx b/apps/carbon/app/routes/x+/part+/$itemId.sales.customer-parts.new.tsxindex 0f350761ec..f40f819e99 100644--- a/apps/carbon/app/routes/x+/part+/$itemId.sales.customer-parts.new.tsx+++ b/apps/carbon/app/routes/x+/part+/$itemId.sales.customer-parts.new.tsx@@ -34,12 +34,15 @@ export async function action({ request, params }: ActionFunctionArgs) {});if (createCustomerPart.error) {+ const flashMessage =+ // 23505 means the unique constraint on ("customerId", "itemId") was violated+ createCustomerPart.error.code == "23505"+ ? "Customer Part record already defined for customer"+ : "Failed to create customer part";+throw redirect(path.to.partSales(itemId),- await flash(- request,- error(createCustomerPart.error, "Failed to create part supplier")- )+ await flash(request, error(createCustomerPart.error, flashMessage)));}