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.

style: maximum width for table cells

Brad Barbinc0ca35254ef0
diff --git a/apps/erp/app/components/Table/components/Cell.tsx b/apps/erp/app/components/Table/components/Cell.tsx
index 0c91737f05..d9edcf8d6d 100644
--- a/apps/erp/app/components/Table/components/Cell.tsx
+++ b/apps/erp/app/components/Table/components/Cell.tsx
@@ -57,7 +57,7 @@ const Cell = <T extends object>({
return (
<Td
className={cn(
- "relative px-4 py-2 whitespace-nowrap text-sm outline-none",
+ "relative px-4 py-2 whitespace-nowrap text-sm outline-none max-w-[30dvw] truncate",
wasEdited && "bg-yellow-100 dark:bg-yellow-900",
isEditMode && !hasEditableTableCellComponent && "bg-muted/50",
isEditMode && "border-border border-r",
diff --git a/packages/database/supabase/functions/create/index.ts b/packages/database/supabase/functions/create/index.ts
index ef3fd07d0c..1153173787 100644
--- a/packages/database/supabase/functions/create/index.ts
+++ b/packages/database/supabase/functions/create/index.ts
@@ -2090,8 +2090,10 @@ serve(async (req: Request) => {
[]) {
if (!salesOrderLine.itemId) return;
- const quantityToShip =
- (job.quantityComplete ?? 0) - (job.quantityShipped ?? 0);
+ const quantityToShip = Math.max(
+ 0,
+ (job.quantityComplete ?? 0) - (job.quantityShipped ?? 0)
+ );
if (!isSerial || (isSerial && quantityToShip > 0)) {
const fulfillment = await trx
@@ -2375,8 +2377,10 @@ serve(async (req: Request) => {
if (salesOrderLine.data.methodType === "Make") {
for await (const job of jobs.data ?? []) {
if (!salesOrderLine.data.itemId) return;
- const quantityToShip =
- (job.quantityComplete ?? 0) - (job.quantityShipped ?? 0);
+ const quantityToShip = Math.max(
+ 0,
+ (job.quantityComplete ?? 0) - (job.quantityShipped ?? 0)
+ );
if (!isSerial || (isSerial && quantityToShip > 0)) {
const fulfillment = await trx
@@ -2408,7 +2412,10 @@ serve(async (req: Request) => {
fulfillmentId,
itemId: salesOrderLine.data.itemId,
orderQuantity: job.productionQuantity ?? 0,
- outstandingQuantity: job.productionQuantity ?? 0,
+ outstandingQuantity: Math.max(
+ 0,
+ job.productionQuantity ?? 0
+ ),
shippedQuantity: quantityToShip,
requiresSerialTracking: isSerial,
requiresBatchTracking: isBatch,
@@ -2464,9 +2471,11 @@ serve(async (req: Request) => {
}
}
} else {
- const outstandingQuantity =
+ const outstandingQuantity = Math.max(
+ 0,
(salesOrderLine.data.saleQuantity ?? 0) -
- previouslyShippedQuantity;
+ previouslyShippedQuantity
+ );
const shippingAndTaxUnitCost =
(salesOrderLine.data.shippingCost /
@@ -2482,8 +2491,8 @@ serve(async (req: Request) => {
companyId: companyId,
itemId: salesOrderLine.data.itemId!,
orderQuantity: salesOrderLine.data.saleQuantity ?? 0,
- outstandingQuantity: outstandingQuantity!,
- shippedQuantity: outstandingQuantity!,
+ outstandingQuantity: outstandingQuantity,
+ shippedQuantity: outstandingQuantity,
requiresSerialTracking: isSerial,
requiresBatchTracking: isBatch,
unitPrice: shippingAndTaxUnitCost,