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.

Add interaction docs to SQ email and update filters

Gaurav Bhatta2c856d00cd7
diff --git a/.gitignore b/.gitignore
index cdb11f59f0..54b3bb9633 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,3 +37,13 @@ packages/database/supabase/seed.sql
.env*.local
.react-router
+
+# Rust
+**/target/
+**/*.rs.bk
+**/pkg/
+**/pkg/
+
+# C++ (cad-engine)
+**/build/
+!**/build/.gitkeep
diff --git a/apps/erp/app/modules/settings/settings.models.ts b/apps/erp/app/modules/settings/settings.models.ts
index 3fc200a074..5ee05ea0f9 100644
--- a/apps/erp/app/modules/settings/settings.models.ts
+++ b/apps/erp/app/modules/settings/settings.models.ts
@@ -12,6 +12,7 @@ export const modulesType = [
"Production",
// "Messaging",
"Purchasing",
+ "Quality",
"Resources",
"Sales",
"Users"
diff --git a/apps/erp/app/routes/x+/supplier-quote+/$id.send.tsx b/apps/erp/app/routes/x+/supplier-quote+/$id.send.tsx
index 201b28fc78..0fdf25bc68 100644
--- a/apps/erp/app/routes/x+/supplier-quote+/$id.send.tsx
+++ b/apps/erp/app/routes/x+/supplier-quote+/$id.send.tsx
@@ -8,6 +8,7 @@ import type { ActionFunctionArgs } from "react-router";
import { redirect } from "react-router";
import {
getSupplierContact,
+ getSupplierInteractionDocuments,
getSupplierInteractionLineDocuments,
getSupplierQuote,
getSupplierQuoteLines,
@@ -116,6 +117,35 @@ export async function action(args: ActionFunctionArgs) {
const attachments: Array<{ filename: string; content: string }> = [];
if (sendAttachments) {
+ // Fetch top-level supplier interaction documents
+ const interactionId = supplierQuote.data.supplierInteractionId;
+ if (interactionId) {
+ const topDocs = await getSupplierInteractionDocuments(
+ client,
+ companyId,
+ interactionId
+ );
+
+ for (const doc of topDocs) {
+ const { data: fileData } = await client.storage
+ .from("private")
+ .download(
+ `${companyId}/supplier-interaction/${interactionId}/${doc.name}`
+ );
+
+ if (fileData) {
+ const arrayBuffer = await fileData.arrayBuffer();
+ const base64 = Buffer.from(arrayBuffer).toString("base64");
+
+ attachments.push({
+ filename: doc.name,
+ content: base64
+ });
+ }
+ }
+ }
+
+ // Fetch line-level supplier interaction documents
const lines = await getSupplierQuoteLines(client, id);
if (lines.data) {