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: open opportunity line pdf in new tab

Brad Barbin76fc76660707
diff --git a/apps/erp/app/modules/sales/ui/Opportunity/OpportunityDocuments.tsx b/apps/erp/app/modules/sales/ui/Opportunity/OpportunityDocuments.tsx
index 6fd0000fb4..6a4a7663b3 100644
--- a/apps/erp/app/modules/sales/ui/Opportunity/OpportunityDocuments.tsx
+++ b/apps/erp/app/modules/sales/ui/Opportunity/OpportunityDocuments.tsx
@@ -221,7 +221,19 @@ const DraggableCell = ({
<LuGripVertical className="w-4 h-4 flex-shrink-0" />
)}
<DocumentIcon type={getDocumentType(attachment.name)} />
- <span className="font-medium" onClick={() => download(attachment)}>
+ <span
+ className="font-medium cursor-pointer"
+ onClick={() => {
+ if (isPreviewable) {
+ window.open(
+ path.to.file.previewFile(`private/${getPath(attachment)}`),
+ "_blank"
+ );
+ } else {
+ download(attachment);
+ }
+ }}
+ >
{isPreviewable ? (
<DocumentPreview
bucket="private"
diff --git a/apps/erp/app/modules/sales/ui/Opportunity/OpportunityLineDocuments.tsx b/apps/erp/app/modules/sales/ui/Opportunity/OpportunityLineDocuments.tsx
index 6151ebf462..656396cbff 100644
--- a/apps/erp/app/modules/sales/ui/Opportunity/OpportunityLineDocuments.tsx
+++ b/apps/erp/app/modules/sales/ui/Opportunity/OpportunityLineDocuments.tsx
@@ -387,8 +387,9 @@ const OpportunityLineDocuments = ({
<HStack>
<DocumentIcon type={type} />
<span
- className="font-medium"
+ className="font-medium cursor-pointer"
onClick={() => {
+ console.log(type, file);
if (["PDF", "Image"].includes(type)) {
window.open(
path.to.file.previewFile(