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: use opportunity path for generated quote pdf

Brad Barbin06901bbd3971
diff --git a/apps/carbon/app/modules/production/ui/Jobs/JobBoMExplorer.tsx b/apps/carbon/app/modules/production/ui/Jobs/JobBoMExplorer.tsx
index b8305f1c4f..62d4cb7acf 100644
--- a/apps/carbon/app/modules/production/ui/Jobs/JobBoMExplorer.tsx
+++ b/apps/carbon/app/modules/production/ui/Jobs/JobBoMExplorer.tsx
@@ -65,7 +65,7 @@ const JobBoMExplorer = ({ method }: JobBoMExplorerProps) => {
<div
key={node.id}
className={cn(
- "flex h-8 cursor-pointer items-center overflow-hidden rounded-sm pr-2",
+ "flex h-12 cursor-pointer items-center overflow-hidden rounded-sm pr-2",
getNodePath(node) === location.pathname
? "bg-muted hover:bg-muted/90"
: "bg-transparent hover:bg-muted/90"
diff --git a/apps/carbon/app/routes/x+/quote+/$quoteId.release.tsx b/apps/carbon/app/routes/x+/quote+/$quoteId.release.tsx
index 34f755f7d2..449bc25cf4 100644
--- a/apps/carbon/app/routes/x+/quote+/$quoteId.release.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$quoteId.release.tsx
@@ -7,6 +7,7 @@ import { upsertDocument } from "~/modules/documents";
import {
getCustomer,
getCustomerContact,
+ getOpportunityByQuote,
getQuote,
quoteReleaseValidator,
releaseQuote,
@@ -38,13 +39,25 @@ export async function action(args: ActionFunctionArgs) {
let file: ArrayBuffer;
let fileName: string;
- const quote = await getQuote(client, quoteId);
+ const [quote, opportunity] = await Promise.all([
+ getQuote(client, quoteId),
+ getOpportunityByQuote(client, quoteId),
+ ]);
if (quote.error) {
throw redirect(
path.to.quote(quoteId),
await flash(request, error(quote.error, "Failed to get quote"))
);
}
+ if (opportunity.error) {
+ throw redirect(
+ path.to.quote(quoteId),
+ await flash(
+ request,
+ error(opportunity.error, "Failed to get opportunity")
+ )
+ );
+ }
try {
const pdf = await pdfLoader({ ...args, params: { id: quoteId } });
@@ -56,7 +69,7 @@ export async function action(args: ActionFunctionArgs) {
.toISOString()
.slice(0, -5)}.pdf`;
- const documentFilePath = `${companyId}/quote/${quoteId}/${fileName}`;
+ const documentFilePath = `${companyId}/opportunity/${opportunity.data.id}/${fileName}`;
const documentFileUpload = await client.storage
.from("private")