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: purchase order and quote revisions on documents (#1407)

Naveen Kashyap798630d51dbd
diff --git a/.ai/lessons.md b/.ai/lessons.md
index d5f2cceb2c..2505064986 100644
--- a/.ai/lessons.md
+++ b/.ai/lessons.md
@@ -1073,3 +1073,22 @@ canvas hosting Radix popovers/selects.
**Rule:** In edge functions, batch reads keyed by a large id list go through the Kysely `db` handle (bind parameters, no URL cap) whenever no PostgREST embed is needed. If an embed forces PostgREST, chunk conservatively (≤50 ids) and include `res.error.message` in the thrown error so the failure names its cause. Never swallow a prefetch error into a bare string with no detail.
**Applies to:** `packages/database/supabase/functions/**` batch reads; any `.in(...)` over tree-collected or list-collected ids.
+## Browser code must import `@carbon/documents/utils`, never `@carbon/documents/pdf`
+
+**Context:** Adding a shared `getQuoteDisplayId` / `getPurchaseOrderDisplayId` helper for showing the revision suffix on documents. The natural home looked like the `./pdf` barrel, which already re-exported it for the server-side PDF routes.
+
+**Problem:** `./pdf` is a barrel over every `@react-pdf/renderer` document component. A route `loader`/`action` can import from it safely — React Router strips server-only exports and tree-shakes the rest — but a **client-rendered component** cannot: the `/share/**` quote page and the ERP UI would pull the entire react-pdf graph into the browser bundle for a five-line string helper. The existing convention confirms this: ERP client components only ever import `@carbon/documents/template`, never `/pdf`.
+
+**Rule:** Pure display helpers shared by server and browser belong in `packages/documents/src/utils/` and are exposed through the `./utils` export (type-only deps). Import them from `@carbon/documents/utils` in any component that renders in the browser. `src/utils/index.ts` is an explicit re-export list, not `export *` — the per-document util files each define their own `getLineDescription`, so a wildcard barrel collides.
+
+**Applies to:** `packages/documents/package.json` exports, `packages/documents/src/utils/index.ts`, any `@carbon/documents` import inside `apps/erp/app/modules/**/ui/**` or `apps/erp/app/routes/share+/**`.
+
+## A new row reusing a readable id must qualify it — `externalLink` is UNIQUE per document
+
+**Context:** "Create Quote Revision" failed with a generic "Failed to duplicate quote". The real error was only in the edge-runtime log: `duplicate key value violates unique constraint "externalLink_documentId_documentType_unique"`.
+
+**Problem:** `externalLink` is `UNIQUE (documentId, documentType, companyId)` (`20250711000000_customer-portal-links.sql`). A quote revision deliberately keeps the same readable `quoteId` as its source, and `get-method`'s `quoteToQuote` branch inserted a share-link row keyed on that bare id — so every revision collided with the original's link and rolled back the whole copy transaction. Worse, `deleteQuote` deletes only the `quote` row (the FK points quote→link, so nothing cascades), leaving orphan link rows that re-collide when the same revision number is issued again.
+
+**Rule:** Any new row that reuses an existing readable id must qualify it (`Q000001-1`), and any insert into a table whose unique key can be orphaned by a delete needs `onConflict(...).doUpdateSet(...)` rather than a bare insert. When a user-facing action reports a generic failure, read the edge-runtime container log before theorising — the route's flash message hides the Postgres error code.
+
+**Applies to:** `packages/database/supabase/functions/get-method/index.ts` (`quoteToQuote`), `apps/erp/app/modules/sales/sales.service.ts` (`deleteQuote`), any insert into `externalLink`.
diff --git a/apps/erp/app/components/RevisionSuffix.tsx b/apps/erp/app/components/RevisionSuffix.tsx
new file mode 100644
index 0000000000..1a9561f43a
--- /dev/null
+++ b/apps/erp/app/components/RevisionSuffix.tsx
@@ -0,0 +1,10 @@
+/**
+ * Two-tone revision suffix for display. For plain strings (clipboard,
+ * filenames, titles, emails) use the `@carbon/documents/utils` helpers instead.
+ */
+export function RevisionSuffix({ revisionId }: { revisionId?: number | null }) {
+ if ((revisionId ?? 0) <= 0) return null;
+ return <span className="text-muted-foreground">-{revisionId}</span>;
+}
+
+export default RevisionSuffix;
diff --git a/apps/erp/app/components/index.ts b/apps/erp/app/components/index.ts
index 6de8d73664..bbedf02cf9 100644
--- a/apps/erp/app/components/index.ts
+++ b/apps/erp/app/components/index.ts
@@ -38,6 +38,7 @@ import MotionMoney from "./MotionMoney";
import New from "./New";
import PeriodSelector from "./PeriodSelector";
import RealtimeDataProvider from "./RealtimeDataProvider";
+import { RevisionSuffix } from "./RevisionSuffix";
import SearchFilter from "./SearchFilter";
import { SearchLandingPage } from "./SearchLandingPage";
import Select from "./Select";
@@ -83,6 +84,7 @@ export {
PeriodSelector,
PrintButton,
RealtimeDataProvider,
+ RevisionSuffix,
SearchFilter,
SearchLandingPage,
Select,
diff --git a/apps/erp/app/modules/purchasing/AGENTS.md b/apps/erp/app/modules/purchasing/AGENTS.md
index 31f2785d27..3181ce1f9b 100644
--- a/apps/erp/app/modules/purchasing/AGENTS.md
+++ b/apps/erp/app/modules/purchasing/AGENTS.md
@@ -5,6 +5,7 @@ Purchase orders, supplier management, supplier quotes/interactions, RFQs, and pr
## Key Domain Concepts
- **Purchase Order (PO)** — document sent to a supplier. Statuses: Draft → Needs Approval → To Review → To Receive → To Receive and Invoice → To Invoice → Completed. MUST use `closePurchaseOrder` to close manually.
+- **PO Revision** — `purchaseOrder.revisionId` counts amendments to a released order. Created ONLY when the header dropdown's "Create PO Revision" action posts `createRevision=true`; a plain Reopen never bumps. The write is `reopenPurchaseOrderAsRevision` (Kysely, `purchasing.service.ts`): a compare-and-swap that sets `revisionId = revisionId + 1` **in SQL** with the eligibility conditions (locked status + non-null `orderDate`) in the WHERE clause, so concurrent requests can't collide and an ineligible order matches 0 rows. `canCreatePurchaseOrderRevision` (`purchasing.models.ts`) is the matching pure predicate used to gate the menu item — keep the two in sync. Unlike quotes, a PO revision is in-place: no new row, receipts/invoices stay attached. Displayed as `PO000123-1` when > 0 via `getPurchaseOrderDisplayId` (`@carbon/documents/utils`) on the PDF, email, filenames, and UI; the two-tone in-app rendering uses `<RevisionSuffix>` (`~/components`).
- **Supplier Interaction** — umbrella entity linking a supplier quote to RFQs, POs, and documents. A supplier quote always lives under an interaction.
- **Supplier Quote** — vendor-side pricing with line-level price breaks (`supplierQuoteLinePrice`). Can be finalized (`finalizeSupplierQuote`) and converted to POs via the `convert` edge function.
- **RFQ (Request for Quotation)** — solicits pricing from multiple suppliers. Links to supplier quotes via `purchasingRfqToSupplierQuote`. Statuses managed by `updatePurchasingRFQStatus`.
@@ -31,8 +32,10 @@ Purchase orders, supplier management, supplier quotes/interactions, RFQs, and pr
## Validation Commands
```bash
-pnpm --filter @carbon/erp typecheck
-pnpm --filter @carbon/erp test
+# The app's package name is "erp" — there is no "@carbon/erp" workspace.
+pnpm exec turbo run typecheck --filter=erp
+# apps/erp has no `test` script; run vitest from the app directory.
+cd apps/erp && pnpm exec vitest run app/modules/purchasing
```
## Key Data Model
diff --git a/apps/erp/app/modules/purchasing/purchasing.models.test.ts b/apps/erp/app/modules/purchasing/purchasing.models.test.ts
new file mode 100644
index 0000000000..4d6b329026
--- /dev/null
+++ b/apps/erp/app/modules/purchasing/purchasing.models.test.ts
@@ -0,0 +1,115 @@
+import { describe, expect, it, vi } from "vitest";
+
+// @carbon/glossary's terms.ts evaluates Lingui `msg` macros at module load,
+// which vitest doesn't transform. Nothing under test touches the glossary
+// (it's pulled in via the ../shared barrel), so stub the whole package.
+vi.mock("@carbon/glossary", () => ({
+ getDefinitionText: () => "",
+ getEntry: () => undefined,
+ getTermText: () => "",
+ glossaryEntries: () => [],
+ hasEntry: () => false,
+ listEntries: () => [],
+ lookupEntry: () => undefined,
+ termSlug: (t: string) => t,
+ terms: {}
+}));
+
+import {
+ canCreatePurchaseOrderRevision,
+ isPurchaseOrderLocked,
+ PURCHASE_ORDER_LOCKED_STATUSES,
+ purchaseOrderStatusType
+} from "./purchasing.models";
+
+const ORDER_DATE = "2026-06-01";
+
+describe("canCreatePurchaseOrderRevision", () => {
+ // Full eligibility matrix for reopening (newStatus = "Draft").
+ const reopenMatrix: Array<{
+ currentStatus: (typeof purchaseOrderStatusType)[number];
+ orderDate: string | null;
+ expected: boolean;
+ }> = [
+ { currentStatus: "Draft", orderDate: null, expected: false },
+ { currentStatus: "Draft", orderDate: ORDER_DATE, expected: false },
+ { currentStatus: "Planned", orderDate: null, expected: false },
+ { currentStatus: "Planned", orderDate: ORDER_DATE, expected: false },
+ { currentStatus: "Needs Approval", orderDate: null, expected: false },
+ { currentStatus: "Needs Approval", orderDate: ORDER_DATE, expected: false },
+ { currentStatus: "To Review", orderDate: null, expected: false },
+ { currentStatus: "To Review", orderDate: ORDER_DATE, expected: false },
+ { currentStatus: "Rejected", orderDate: null, expected: false },
+ { currentStatus: "Rejected", orderDate: ORDER_DATE, expected: false },
+ { currentStatus: "To Receive", orderDate: ORDER_DATE, expected: true },
+ {
+ currentStatus: "To Receive and Invoice",
+ orderDate: ORDER_DATE,
+ expected: true
+ },
+ { currentStatus: "To Invoice", orderDate: ORDER_DATE, expected: true },
+ { currentStatus: "Completed", orderDate: ORDER_DATE, expected: true },
+ { currentStatus: "Closed", orderDate: ORDER_DATE, expected: true },
+ { currentStatus: "Closed", orderDate: null, expected: false },
+ { currentStatus: "To Receive", orderDate: null, expected: false }
+ ];
+
+ it.each(
+ reopenMatrix
+ )("reopen from $currentStatus (orderDate: $orderDate) → eligible: $expected", ({
+ currentStatus,
+ orderDate,
+ expected
+ }) => {
+ expect(
+ canCreatePurchaseOrderRevision({
+ newStatus: "Draft",
+ currentStatus,
+ orderDate
+ })
+ ).toBe(expected);
+ });
+
+ it("is never eligible for a non-Draft target status", () => {
+ for (const newStatus of purchaseOrderStatusType) {
+ if (newStatus === "Draft") continue;
+ for (const currentStatus of purchaseOrderStatusType) {
+ expect(
+ canCreatePurchaseOrderRevision({
+ newStatus,
+ currentStatus,
+ orderDate: ORDER_DATE
+ })
+ ).toBe(false);
+ }
+ }
+ });
+
+ it("is not eligible for an unknown or missing current status", () => {
+ expect(
+ canCreatePurchaseOrderRevision({
+ newStatus: "Draft",
+ currentStatus: null,
+ orderDate: ORDER_DATE
+ })
+ ).toBe(false);
+ expect(
+ canCreatePurchaseOrderRevision({
+ newStatus: "Draft",
+ currentStatus: undefined,
+ orderDate: ORDER_DATE
+ })
+ ).toBe(false);
+ });
+
+ it("locked statuses stay consistent with the reopen matrix", () => {
+ const bumpingStatuses = reopenMatrix
+ .filter((row) => row.expected)
+ .map((row) => row.currentStatus)
+ .sort();
+ expect(bumpingStatuses).toEqual([...PURCHASE_ORDER_LOCKED_STATUSES].sort());
+ for (const status of PURCHASE_ORDER_LOCKED_STATUSES) {
+ expect(isPurchaseOrderLocked(status)).toBe(true);
+ }
+ });
+});
diff --git a/apps/erp/app/modules/purchasing/purchasing.models.ts b/apps/erp/app/modules/purchasing/purchasing.models.ts
index 11cea52704..1277a2b4b1 100644
--- a/apps/erp/app/modules/purchasing/purchasing.models.ts
+++ b/apps/erp/app/modules/purchasing/purchasing.models.ts
@@ -631,3 +631,21 @@ export function isPurchaseOrderLocked(
status as PurchaseOrderLockedStatus
);
}
+
+/**
+ * Whether a status change is ELIGIBLE to create a revision — the bump itself
+ * also requires the explicit `createRevision` flag. Only a released order
+ * qualifies: `orderDate` is set at finalize, so an order reopened from
+ * "Needs Approval" or closed straight from Draft never reached the supplier.
+ */
+export function canCreatePurchaseOrderRevision(transition: {
+ newStatus: (typeof purchaseOrderStatusType)[number];
+ currentStatus: string | null | undefined;
+ orderDate: string | null | undefined;
+}): boolean {
+ return (
+ transition.newStatus === "Draft" &&
+ isPurchaseOrderLocked(transition.currentStatus) &&
+ Boolean(transition.orderDate)
+ );
+}
diff --git a/apps/erp/app/modules/purchasing/purchasing.service.ts b/apps/erp/app/modules/purchasing/purchasing.service.ts
index 036768d1c7..dec71a81a9 100644
--- a/apps/erp/app/modules/purchasing/purchasing.service.ts
+++ b/apps/erp/app/modules/purchasing/purchasing.service.ts
@@ -41,10 +41,11 @@ import type {
supplierTypeValidator,
supplierValidator
} from "./purchasing.models";
+import { PURCHASE_ORDER_LOCKED_STATUSES } from "./purchasing.models";
import type { PurchaseOrder, PurchasingRFQ, SupplierQuote } from "./types";
const PURCHASE_ORDERS_LIST_COLUMNS =
- "id,purchaseOrderId,status,orderDate,supplierId,supplierReference,assignee,companyId,customFields,createdAt,createdBy,updatedAt,updatedBy,thumbnailPath,itemType,orderTotal,receivableQuantity,receivedQuantity,shippingMethodId,receiptRequestedDate,receiptPromisedDate,deliveryDate,dropShipment,paymentTermId,createdByFullName,assigneeFullName" as const;
+ "id,purchaseOrderId,revisionId,status,orderDate,supplierId,supplierReference,assignee,companyId,customFields,createdAt,createdBy,updatedAt,updatedBy,thumbnailPath,itemType,orderTotal,receivableQuantity,receivedQuantity,shippingMethodId,receiptRequestedDate,receiptPromisedDate,deliveryDate,dropShipment,paymentTermId,createdByFullName,assigneeFullName" as const;
const logger = getLogger("erp", "purchasing-service");
@@ -1212,6 +1213,43 @@ export async function updatePurchaseOrderStatus(
return client.from("purchaseOrder").update(update).eq("id", update.id);
}
+/**
+ * Reopens a released purchase order to Draft as its next revision.
+ *
+ * Compare-and-swap: the increment and the eligibility conditions are both in
+ * SQL, so concurrent requests can't share a revision number and an ineligible
+ * order matches no rows. Returns rows updated — 0 means it was not eligible.
+ */
+export async function reopenPurchaseOrderAsRevision(
+ db: Kysely<KyselyDatabase>,
+ {
+ id,
+ companyId,
+ updatedBy
+ }: {
+ id: string;
+ companyId: string;
+ updatedBy: string;
+ }
+) {
+ const result = await db
+ .updateTable("purchaseOrder")
+ .set((eb) => ({
+ status: "Draft" as const,
+ assignee: null,
+ revisionId: eb("revisionId", "+", 1),
+ updatedBy,
+ updatedAt: datetime.timestamp()
+ }))
+ .where("id", "=", id)
+ .where("companyId", "=", companyId)
+ .where("status", "in", [...PURCHASE_ORDER_LOCKED_STATUSES])
+ .where("orderDate", "is not", null)
+ .executeTakeFirst();
+
+ return Number(result.numUpdatedRows ?? 0);
+}
+
export async function updateSupplierAccounting(
client: SupabaseClient<Database>,
supplierAccounting: z.infer<typeof supplierAccountingValidator> & {
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderFinalizeModal.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderFinalizeModal.tsx
index b01700f0ac..c81e234dca 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderFinalizeModal.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderFinalizeModal.tsx
@@ -1,3 +1,4 @@
+import { getPurchaseOrderDisplayId } from "@carbon/documents/utils";
import { ValidatedForm } from "@carbon/form";
import {
Button,
@@ -76,7 +77,9 @@ const PurchaseOrderFinalizeModal = ({
fetcher={fetcher}
>
<ModalHeader>
- <ModalTitle>{`Finalize ${purchaseOrder?.purchaseOrderId}`}</ModalTitle>
+ <ModalTitle>{`Finalize ${getPurchaseOrderDisplayId(
+ purchaseOrder
+ )}`}</ModalTitle>
<ModalDescription>
Are you sure you want to finalize the purchase order? Finalizing
the order will affect on order quantities used to calculate supply
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader.tsx
index 2d4417c07f..39d6ec9f67 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader.tsx
@@ -1,3 +1,4 @@
+import { getPurchaseOrderDisplayId } from "@carbon/documents/utils";
import {
Badge,
Button,
@@ -30,6 +31,7 @@ import {
LuEllipsisVertical,
LuEye,
LuFile,
+ LuGitBranchPlus,
LuHandCoins,
LuLoaderCircle,
LuPanelLeft,
@@ -39,6 +41,7 @@ import {
LuX
} from "react-icons/lu";
import { Link, useFetcher, useNavigation, useParams } from "react-router";
+import { RevisionSuffix } from "~/components";
import type { ResolvedAttachmentItem } from "~/components/AttachmentsList";
import { useAuditLog } from "~/components/AuditLog";
import { usePanels } from "~/components/Layout";
@@ -56,7 +59,10 @@ import PurchaseInvoicingStatus from "~/modules/invoicing/ui/PurchaseInvoice/Purc
import type { ApprovalDecision } from "~/modules/shared/types";
import { useSuppliers } from "~/stores/suppliers";
import { path } from "~/utils/path";
-import { isPurchaseOrderLocked } from "../../purchasing.models";
+import {
+ canCreatePurchaseOrderRevision,
+ isPurchaseOrderLocked
+} from "../../purchasing.models";
import type { PurchaseOrder, PurchaseOrderLine } from "../../types";
import PurchaseOrderApprovalModal from "./PurchaseOrderApprovalModal";
import PurchaseOrderFinalizeModal from "./PurchaseOrderFinalizeModal";
@@ -156,11 +162,19 @@ const PurchaseOrderHeader = () => {
const finalizeDisclosure = useDisclosure();
const deleteModal = useDisclosure();
const cancelModal = useDisclosure();
+ const createRevisionModal = useDisclosure();
const [approvalDecision, setApprovalDecision] =
useState<ApprovalDecision | null>(null);
const relatedDocsErrorMessage = t`Couldn't load related documents. Refresh before creating a new one to avoid duplicates.`;
+ // Interpolated into translated confirmations, so the fallback has to be
+ // translated too — a raw English literal would render mid-sentence in every
+ // other locale.
+ const orderLabel =
+ getPurchaseOrderDisplayId(routeData?.purchaseOrder) ||
+ t`this purchase order`;
+
const isOutsideProcessing =
routeData?.purchaseOrder?.purchaseOrderType === "Outside Processing";
const hasShipments = shipments.length > 0;
@@ -195,10 +209,15 @@ const PurchaseOrderHeader = () => {
/>
<Link to={path.to.purchaseOrderDetails(orderId)}>
<Heading size="h4" className="flex items-center gap-2">
- {routeData?.purchaseOrder?.purchaseOrderId}
+ <span className="flex items-center gap-0">
+ <span>{routeData?.purchaseOrder?.purchaseOrderId}</span>
+ <RevisionSuffix
+ revisionId={routeData?.purchaseOrder?.revisionId}
+ />
+ </span>
</Heading>
</Link>
- <Copy text={routeData?.purchaseOrder?.purchaseOrderId ?? ""} />
+ <Copy text={getPurchaseOrderDisplayId(routeData?.purchaseOrder)} />
<DropdownMenu>
<DropdownMenuTrigger asChild>
<IconButton
@@ -233,6 +252,21 @@ const PurchaseOrderHeader = () => {
<DropdownMenuIcon icon={<LuLoaderCircle />} />
<Trans>Reopen</Trans>
</DropdownMenuItem>
+ <DropdownMenuItem
+ disabled={
+ !canCreatePurchaseOrderRevision({
+ newStatus: "Draft",
+ currentStatus: routeData?.purchaseOrder?.status,
+ orderDate: routeData?.purchaseOrder?.orderDate
+ }) ||
+ statusFetcher.state !== "idle" ||
+ !permissions.can("delete", "purchasing")
+ }
+ onClick={createRevisionModal.onOpen}
+ >
+ <DropdownMenuIcon icon={<LuGitBranchPlus />} />
+ <Trans>Create PO Revision</Trans>
+ </DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem
disabled={
@@ -625,8 +659,8 @@ const PurchaseOrderHeader = () => {
<ConfirmDelete
action={path.to.deletePurchaseOrder(orderId)}
isOpen={deleteModal.isOpen}
- name={routeData?.purchaseOrder?.purchaseOrderId ?? "purchase order"}
- text={t`Are you sure you want to delete ${routeData?.purchaseOrder?.purchaseOrderId}? This cannot be undone.`}
+ name={orderLabel}
+ text={t`Are you sure you want to delete ${orderLabel}? This cannot be undone.`}
onCancel={() => {
deleteModal.onClose();
}}
@@ -639,7 +673,7 @@ const PurchaseOrderHeader = () => {
<Confirm
action={path.to.purchaseOrderStatus(orderId)}
title={t`Cancel Purchase Order`}
- text={t`Are you sure you want to cancel ${routeData?.purchaseOrder?.purchaseOrderId ?? "this purchase order"}? This will close the order.`}
+ text={t`Are you sure you want to cancel ${orderLabel}? This will close the order.`}
confirmText={t`Cancel Order`}
confirmVariant="destructive"
cancelText={t`Back`}
@@ -649,6 +683,21 @@ const PurchaseOrderHeader = () => {
<input type="hidden" name="status" value="Closed" />
</Confirm>
)}
+ {createRevisionModal.isOpen && (
+ <Confirm
+ action={path.to.purchaseOrderStatus(orderId)}
+ title={t`Create PO Revision`}
+ text={t`${orderLabel} will be reopened for editing as revision ${
+ (routeData?.purchaseOrder?.revisionId ?? 0) + 1
+ }. The document already sent to the supplier is unchanged until you finalize and resend the order.`}
+ confirmText={t`Create Revision`}
+ onCancel={createRevisionModal.onClose}
+ onSubmit={createRevisionModal.onClose}
+ >
+ <input type="hidden" name="status" value="Draft" />
+ <input type="hidden" name="createRevision" value="true" />
+ </Confirm>
+ )}
{approvalDecision && routeData?.approvalRequest?.id && (
<PurchaseOrderApprovalModal
purchaseOrder={routeData?.purchaseOrder}
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderProperties.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderProperties.tsx
index 68296646ad..79e46bade0 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderProperties.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderProperties.tsx
@@ -1,4 +1,5 @@
import type { Json } from "@carbon/database";
+import { getPurchaseOrderDisplayId } from "@carbon/documents/utils";
import { DatePicker, InputControlled, ValidatedForm } from "@carbon/form";
import {
Badge,
@@ -166,7 +167,7 @@ const PurchaseOrderProperties = () => {
className="p-1"
onClick={() =>
copyToClipboard(
- routeData?.purchaseOrder?.purchaseOrderId ?? ""
+ getPurchaseOrderDisplayId(routeData?.purchaseOrder)
)
}
>
@@ -180,7 +181,7 @@ const PurchaseOrderProperties = () => {
</HStack>
</HStack>
<span className="text-sm">
- {routeData?.purchaseOrder?.purchaseOrderId}
+ {getPurchaseOrderDisplayId(routeData?.purchaseOrder)}
</span>
</VStack>
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSummary.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSummary.tsx
index 621a250635..204996e7de 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSummary.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSummary.tsx
@@ -21,7 +21,12 @@ import { motion } from "framer-motion";
import { useState } from "react";
import { LuChevronRight, LuImage } from "react-icons/lu";
import { Link, useParams } from "react-router";
-import { DateTime, MethodIcon, SupplierAvatar } from "~/components";
+import {
+ DateTime,
+ MethodIcon,
+ RevisionSuffix,
+ SupplierAvatar
+} from "~/components";
import { useAccounts } from "~/components/Form/Account";
import { useUnitOfMeasure } from "~/components/Form/UnitOfMeasure";
import {
@@ -473,7 +478,12 @@ const PurchaseOrderSummary = ({
<CardHeader>
<HStack className="justify-between items-center">
<div className="flex flex-col gap-1">
- <CardTitle>{routeData?.purchaseOrder.purchaseOrderId}</CardTitle>
+ <CardTitle className="flex items-center gap-0">
+ <span>{routeData?.purchaseOrder.purchaseOrderId}</span>
+ <RevisionSuffix
+ revisionId={routeData?.purchaseOrder?.revisionId}
+ />
+ </CardTitle>
<CardDescription>
<Trans>Purchase Order</Trans>
</CardDescription>
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrdersTable.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrdersTable.tsx
index 038cd3a952..8fb44d40a9 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrdersTable.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrdersTable.tsx
@@ -39,6 +39,7 @@ import {
Hyperlink,
ItemThumbnail,
New,
+ RevisionSuffix,
SupplierAvatar,
Table
} from "~/components";
@@ -98,7 +99,10 @@ const PurchaseOrdersTable = memo(
type={row.original.itemType}
/>
<Hyperlink to={path.to.purchaseOrderDetails(row.original.id!)}>
- {row.original.purchaseOrderId}
+ <div className="flex justify-start items-center gap-0">
+ <span>{row.original.purchaseOrderId}</span>
+ <RevisionSuffix revisionId={row.original.revisionId} />
+ </div>
</Hyperlink>
</HStack>
),
diff --git a/apps/erp/app/modules/purchasing/ui/SupplierInteraction/SupplierInteractionState.tsx b/apps/erp/app/modules/purchasing/ui/SupplierInteraction/SupplierInteractionState.tsx
index 889f2eea81..2cba338298 100644
--- a/apps/erp/app/modules/purchasing/ui/SupplierInteraction/SupplierInteractionState.tsx
+++ b/apps/erp/app/modules/purchasing/ui/SupplierInteraction/SupplierInteractionState.tsx
@@ -1,3 +1,7 @@
+import {
+ getPurchaseOrderDisplayId,
+ withRevisionSuffix
+} from "@carbon/documents/utils";
import {
Button,
cn,
@@ -47,6 +51,20 @@ type SupplierInteractionStateProps = {
siblingQuotes?: LinkedSupplierQuote[];
};
+/** "Acme Tooling (SQ000012-1)", degrading to whichever half is known. */
+function buildSupplierQuoteLabel(
+ supplierName: string | undefined,
+ quoteDisplayId: string,
+ quoteId: string
+) {
+ if (supplierName) {
+ return quoteDisplayId
+ ? `${supplierName} (${quoteDisplayId})`
+ : supplierName;
+ }
+ return quoteDisplayId || `Quote ${quoteId}`;
+}
+
function getSupplierInteractionIcon(state: string) {
switch (state) {
case "RFQ":
@@ -195,23 +213,11 @@ const SupplierInteractionState = ({
return {
id: quote.id!,
- label: supplierName
- ? `${supplierName}${
- quote.supplierQuoteId
- ? ` (${quote.supplierQuoteId}${
- quote.revisionId && quote.revisionId > 0
- ? `-${quote.revisionId}`
- : ""
- })`
- : ""
- }`
- : quote.supplierQuoteId
- ? `${quote.supplierQuoteId}${
- quote.revisionId && quote.revisionId > 0
- ? `-${quote.revisionId}`
- : ""
- }`
- : `Quote ${quote.id}`,
+ label: buildSupplierQuoteLabel(
+ supplierName,
+ withRevisionSuffix(quote.supplierQuoteId, quote.revisionId),
+ quote.id!
+ ),
path: path.to.supplierQuoteDetails(quote.id!)
};
})
@@ -285,11 +291,7 @@ const SupplierInteractionState = ({
const orderItems = orders.map((order) => ({
id: order.id!,
label: order.purchaseOrderId
- ? `${order.purchaseOrderId}${
- order.revisionId && order.revisionId > 0
- ? `-${order.revisionId}`
- : ""
- }`
+ ? getPurchaseOrderDisplayId(order)
: `Order ${order.id}`,
path: path.to.purchaseOrderDetails(order.id!)
}));
diff --git a/apps/erp/app/modules/sales/AGENTS.md b/apps/erp/app/modules/sales/AGENTS.md
index 453d6145c7..7e5f9570ba 100644
--- a/apps/erp/app/modules/sales/AGENTS.md
+++ b/apps/erp/app/modules/sales/AGENTS.md
@@ -6,6 +6,7 @@ Quotes (with cost rollup and pricing), sales orders, sales RFQs, customer manage
- **Opportunity** — deal container linking RFQs, quotes, and sales orders for one customer engagement.
- **Quote** — detailed cost estimate with line items, each having a make method (BOM + routing) and quantity-break pricing. Statuses: Draft → Pending → Sent → Ordered / Lost / Cancelled.
+- **Quote Revision** — `quote.revisionId`. Unlike a PO (amended in place), a quote revision is a **new `quote` row** created by `copyQuote` → the `get-method` edge function (`quoteToQuote`, `asRevision: true`), keeping the same `quoteId` with `revisionId = max + 1`, sharing the source `opportunityId`. Each revision gets its **own `externalLink`** row, whose `documentId` is revision-qualified (`Q000001-1`) because `externalLink` is UNIQUE on `(documentId, documentType, companyId)` — an unqualified id collides with the original's link. `deleteQuote` does not remove the link row, so that insert uses `onConflict … doUpdateSet` to reuse the orphan a deleted revision left behind. Displayed as `Q000001-1` when > 0 via `getQuoteDisplayId` (`@carbon/documents/utils`) on the PDF, email, share page, and filenames; two-tone in-app rendering uses `<RevisionSuffix>` (`~/components`).
- **Quote Line Pricing** — per-quantity-break pricing. PK is `(quoteLineId, quantity)` — no `id` column. `discountPercent` is a **fraction 0–1** (not 0–100). Generated columns compute net/converted prices.
- **Pricing Rules** — company-scoped Discount/Markup rules. Discounts are non-stacking (highest-priority wins); Markups stack and compound in priority order.
- **Price Overrides** — customer-specific or type-specific price overrides with quantity breaks via `customerItemPriceOverride` / `customerItemPriceOverrideBreak`. Precedence: customer > customer-type > all-customers > base price.
@@ -33,8 +34,10 @@ Quotes (with cost rollup and pricing), sales orders, sales RFQs, customer manage
## Validation Commands
```bash
-pnpm --filter @carbon/erp typecheck
-pnpm --filter @carbon/erp test -- --testPathPattern=sales
+# The app's package name is "erp" — there is no "@carbon/erp" workspace.
+pnpm exec turbo run typecheck --filter=erp
+# apps/erp has no `test` script; run vitest from the app directory.
+cd apps/erp && pnpm exec vitest run app/modules/sales
```
## Key Data Model
diff --git a/apps/erp/app/modules/sales/ui/Opportunity/OpportunityState.tsx b/apps/erp/app/modules/sales/ui/Opportunity/OpportunityState.tsx
index de4dd4a824..bee7dfb422 100644
--- a/apps/erp/app/modules/sales/ui/Opportunity/OpportunityState.tsx
+++ b/apps/erp/app/modules/sales/ui/Opportunity/OpportunityState.tsx
@@ -1,3 +1,4 @@
+import { getQuoteDisplayId, withRevisionSuffix } from "@carbon/documents/utils";
import {
Button,
cn,
@@ -101,34 +102,22 @@ function getItems(opportunity: Opportunity, state: string) {
return opportunity.salesRfqs.map((rfq) => ({
id: rfq.id!,
label: rfq.rfqId
- ? `${rfq.rfqId}${
- rfq.revisionId && rfq.revisionId > 0 ? `-${rfq.revisionId}` : ""
- }`
+ ? withRevisionSuffix(rfq.rfqId, rfq.revisionId)
: `RFQ ${rfq.id}`,
path: path.to.salesRfqDetails(rfq.id!)
}));
case "Quote":
return opportunity.quotes.map((quote) => ({
id: quote.id!,
- label: quote.quoteId
- ? `${quote.quoteId}${
- quote.revisionId && quote.revisionId > 0
- ? `-${quote.revisionId}`
- : ""
- }`
- : `Quote ${quote.id}`,
+ label: quote.quoteId ? getQuoteDisplayId(quote) : `Quote ${quote.id}`,
path: path.to.quoteDetails(quote.id!)
}));
case "Order":
return opportunity.salesOrders.map((order) => ({
id: order.id!,
- label: order.salesOrderId
- ? `${order.salesOrderId}${
- order.revisionId && order.revisionId > 0
- ? `-${order.revisionId}`
- : ""
- }`
- : `Order ${order.id}`,
+ // Sales orders are not revised — the column exists but nothing writes
+ // it, so this only ever renders the bare id.
+ label: order.salesOrderId ?? `Order ${order.id}`,
path: path.to.salesOrderDetails(order.id!)
}));
default:
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteFinalizeModal.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteFinalizeModal.tsx
index 8090fcd0c5..d8af55a0eb 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteFinalizeModal.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteFinalizeModal.tsx
@@ -1,4 +1,5 @@
import { useCarbon } from "@carbon/auth";
+import { getQuoteDisplayId } from "@carbon/documents/utils";
import { ValidatedForm } from "@carbon/form";
import {
Alert,
@@ -170,7 +171,7 @@ const QuotationFinalizeModal = ({
fetcher={fetcher}
>
<ModalHeader>
- <ModalTitle>{`Finalize ${quote?.quoteId}`}</ModalTitle>
+ <ModalTitle>{`Finalize ${getQuoteDisplayId(quote)}`}</ModalTitle>
<ModalDescription>
<Trans>Are you sure you want to finalize the quote?</Trans>
</ModalDescription>
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteHeader.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteHeader.tsx
index 83cab656a4..8f187f90bc 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteHeader.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteHeader.tsx
@@ -1,3 +1,4 @@
+import { getQuoteDisplayId } from "@carbon/documents/utils";
import {
Button,
Copy,
@@ -45,6 +46,7 @@ import {
LuTrophy
} from "react-icons/lu";
import { Link, useFetcher, useParams } from "react-router";
+import { RevisionSuffix } from "~/components";
import { useAuditLog } from "~/components/AuditLog";
import { usePanels } from "~/components/Layout";
import ConfirmDelete from "~/components/Modals/ConfirmDelete";
@@ -117,14 +119,10 @@ const QuoteHeader = () => {
className="flex items-center justify-start gap-0"
>
<span>{routeData?.quote?.quoteId}</span>
- {(routeData?.quote?.revisionId ?? 0) > 0 && (
- <span className="text-muted-foreground">
- -{routeData?.quote?.revisionId}
- </span>
- )}
+ <RevisionSuffix revisionId={routeData?.quote?.revisionId} />
</Heading>
</Link>
- <Copy text={routeData?.quote?.quoteId ?? ""} />
+ <Copy text={getQuoteDisplayId(routeData?.quote)} />
<DropdownMenu>
<DropdownMenuTrigger asChild>
<IconButton
@@ -372,9 +370,10 @@ const QuoteHeader = () => {
<ConfirmDelete
action={path.to.deleteQuote(quoteId)}
isOpen={deleteQuoteModal.isOpen}
- name={routeData?.quote?.quoteId!}
- text={t`Are you sure you want to delete ${routeData?.quote
- ?.quoteId!}? This cannot be undone.`}
+ name={getQuoteDisplayId(routeData?.quote)}
+ text={t`Are you sure you want to delete ${getQuoteDisplayId(
+ routeData?.quote
+ )}? This cannot be undone.`}
onCancel={() => {
deleteQuoteModal.onClose();
}}
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteLineMethodForm.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteLineMethodForm.tsx
index fc6a1ae444..8e0f10bc68 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteLineMethodForm.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteLineMethodForm.tsx
@@ -4,6 +4,7 @@ import { useLingui } from "@lingui/react/macro";
import type { PostgrestResponse } from "@supabase/supabase-js";
import { useEffect, useMemo, useState } from "react";
import { useFetcher } from "react-router";
+import { RevisionSuffix } from "~/components";
import { path } from "~/utils/path";
import type { getQuoteLinesList } from "../../sales.service";
@@ -38,9 +39,7 @@ export function QuoteLineMethodForm() {
label: (
<div className="flex justify-start items-center gap-0">
<span>{quote.quoteId}</span>
- {(quote.revisionId ?? 0) > 0 && (
- <span className="text-muted-foreground">-{quote.revisionId}</span>
- )}
+ <RevisionSuffix revisionId={quote.revisionId} />
</div>
),
value: quote.id
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteProperties.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteProperties.tsx
index a2206f1756..ac83efd6ee 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteProperties.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteProperties.tsx
@@ -1,4 +1,5 @@
import type { Json } from "@carbon/database";
+import { getQuoteDisplayId } from "@carbon/documents/utils";
import { DatePicker, InputControlled, ValidatedForm } from "@carbon/form";
import {
Button,
@@ -149,7 +150,7 @@ const QuoteProperties = () => {
size="sm"
className="p-1"
onClick={() =>
- copyToClipboard(routeData?.quote?.quoteId ?? "")
+ copyToClipboard(getQuoteDisplayId(routeData?.quote))
}
>
<LuCopy className="w-3 h-3" />
@@ -161,7 +162,7 @@ const QuoteProperties = () => {
</Tooltip>
</HStack>
</HStack>
- <span className="text-sm">{routeData?.quote?.quoteId}</span>
+ <span className="text-sm">{getQuoteDisplayId(routeData?.quote)}</span>
</VStack>
<Assignee
id={quoteId}
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsx
index be11226c4f..e09e5f58df 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsx
@@ -24,7 +24,12 @@ import type { Dispatch, SetStateAction } from "react";
import { useEffect, useMemo, useState } from "react";
import { LuChevronRight, LuImage } from "react-icons/lu";
import { Link, useParams } from "react-router";
-import { CustomerAvatar, DateTime, MotionMoney } from "~/components";
+import {
+ CustomerAvatar,
+ DateTime,
+ MotionMoney,
+ RevisionSuffix
+} from "~/components";
import {
useCurrencyDecimals,
useCurrencyFormatter,
@@ -842,11 +847,7 @@ const QuoteSummary = ({
<div className="flex flex-col gap-1">
<CardTitle className="flex items-center gap-0">
<span>{routeData?.quote.quoteId}</span>
- {(routeData?.quote.revisionId ?? 0) > 0 && (
- <span className="text-muted-foreground">
- -{routeData?.quote.revisionId}
- </span>
- )}
+ <RevisionSuffix revisionId={routeData?.quote.revisionId} />
</CardTitle>
<CardDescription>
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuotesTable.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuotesTable.tsx
index 9d380b6f3b..efb9cea843 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuotesTable.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuotesTable.tsx
@@ -1,3 +1,4 @@
+import { getQuoteDisplayId } from "@carbon/documents/utils";
import {
BarProgress,
HStack,
@@ -27,6 +28,7 @@ import {
Hyperlink,
ItemThumbnail,
New,
+ RevisionSuffix,
Table
} from "~/components";
import { Enumerable } from "~/components/Enumerable";
@@ -78,11 +80,7 @@ const QuotesTable = memo(({ data, count }: QuotesTableProps) => {
<Hyperlink to={path.to.quoteDetails(row.original.id!)}>
<div className="flex justify-start items-center gap-0">
<span>{row.original.quoteId}</span>
- {(row.original.revisionId ?? 0) > 0 && (
- <span className="text-muted-foreground">
- -{row.original.revisionId}
- </span>
- )}
+ <RevisionSuffix revisionId={row.original.revisionId} />
</div>
</Hyperlink>
</HStack>
@@ -334,8 +332,10 @@ const QuotesTable = memo(({ data, count }: QuotesTableProps) => {
<ConfirmDelete
action={path.to.deleteQuote(selectedQuotation.id)}
isOpen={deleteQuotationModal.isOpen}
- name={selectedQuotation.quoteId!}
- text={t`Are you sure you want to delete ${selectedQuotation.quoteId!}? This cannot be undone.`}
+ name={getQuoteDisplayId(selectedQuotation)}
+ text={t`Are you sure you want to delete ${getQuoteDisplayId(
+ selectedQuotation
+ )}? This cannot be undone.`}
onCancel={() => {
deleteQuotationModal.onClose();
setSelectedQuotation(null);
diff --git a/apps/erp/app/modules/settings/AGENTS.md b/apps/erp/app/modules/settings/AGENTS.md
new file mode 100644
index 0000000000..d418acd79e
--- /dev/null
+++ b/apps/erp/app/modules/settings/AGENTS.md
@@ -0,0 +1,114 @@
+# Settings Module
+
+Company configuration: the company/subsidiary records themselves, the ~50-flag `companySettings` row, document templates and reusable sections, numbering sequences, terms, custom fields, integrations, API keys, webhooks, theme, and the backup/restore UI. Almost every other module reads from here (`getCompanySettings`, `getNextSequence`, `getDocumentTemplate`) and almost nothing writes here.
+
+## Key Domain Concepts
+
+- **Company Settings** — exactly one `companySettings` row per company. Its PK **`id` IS the company id**; there is no `companyId` column (`20241127142822_sales-settings.sql`). Read once with `getCompanySettings`; every write is a narrow, single-purpose function (`updateShelfLifeSettings`, `updateKanbanOutputSetting`, `updateMetricSettings`, `updateShowCurrencyTrailingZerosSetting`, …~30 of them).
+- **Company / Subsidiary** — `company` rows sharing a `companyGroupId` form a parent+subsidiaries tree. `getCompanies` / `getEmployeeCompanies` read the `companies` membership view (user↔company) and rewrite logo columns to public storage URLs via `PUBLIC_STORAGE_URL_PREFIX`; `getEmployeeCompanies` additionally filters `role = "employee"` and is the single source for the login callback, company picker, and `x+/_layout` guard. `seedCompany` invokes the `seed-company` edge function.
+- **Document Template** — one `documentTemplate` row per `(companyId, documentType)` holding `blocks` / `theme` / `settings` JSON plus nullable `headerSectionId` / `footerSectionId`. **`documentSection`** rows are company-global reusable rich text (`placement` = `body|header|footer`); system sections live in code, and editing one **forks** it into a real row keyed by the same id (`upsertDocumentSection` → `isBuiltInSectionId`), which then overrides the built-in everywhere.
+- **Sequence** — per-company numbering (`table`, `prefix`, `suffix`, `next`, `step`, `size`) behind readable ids like `PO000123`. `getNextSequence` calls the `get_next_sequence` RPC and **consumes** a number; `getCurrentSequence` only previews it (and re-derives date tokens through `interpolateSequenceDate` in the company timezone so the preview matches what SQL will issue). `itemSerialSequence` is the per-item serial-number equivalent.
+- **Custom Field** — user-defined fields per table (`customField`, read through the `customFieldTables` view). Definitions are Redis-cached under `customFields:{companyId}:*`.
+- **Integration** — per-company third-party config in `companyIntegration` (read through the `integrations` view), Redis-cached under `integrations:{companyId}` and `json:integrations:{companyId}`. An OAuth callback can't render its own failure, so it redirects with `integrationErrorSearch(integration, code)` and the integrations page resolves the code to Lingui copy via `getIntegrationError` (`integration-errors.ts`) — only a code crosses the URL, never the provider's message.
+- **API Key / Webhook** — outbound automation. `upsertApiKey` stores only `keyHash` / `keyPreview` and returns the raw key **once**; `rateLimit`/`rateLimitWindow` are stripped as platform-controlled.
+
+## Safety
+
+### Always
+
+- MUST filter `companySettings` with `.eq("id", companyId)` — there is no `companyId` column. `updateDefaultCustomerCc` (settings.service.ts) currently filters `"companyId"` and is the one outlier; copy any other `update*Setting`, not that one.
+- MUST invalidate the Redis caches after writing integrations or custom fields — `clearCompanyIntegrationCache` / `clearAllIntegrationCaches` / `clearCustomFieldsCache` (`settings.server.ts`). `deactivateIntegration`, `upsertCompanyIntegration`, `upsertCustomField`, and `deleteCustomField` already do.
+- MUST write templates through `upsertDocumentTemplate` — it stamps `CURRENT_TEMPLATE_FORMAT_VERSION` and conflicts on `companyId,documentType` (one template per type per company).
+- MUST read a stored template through `getDocumentTemplateConfig` (or `toDocumentTemplate` + `resolveTemplate`) — the JSON columns are untyped in the generated DB types, and `resolveTemplate` appends built-in blocks added since the row was saved.
+- MUST use `getNextSequence` to consume a document number. `getCurrentSequence` does not increment and must never be used to issue one.
+
+### Ask First
+
+- Editing a `sequence` row (`next`, `size`, `prefix`) for a document type already in use — issued ids can collide.
+- Anything under `backups.*` — `startCompanyRestore` wipes and reloads every company-scoped table (see `.claude/rules/company-backup-restore.md`).
+- Deleting a `documentSection` — `documentTemplate.headerSectionId` / `footerSectionId` are soft refs with **no FK**, so the deletion is silent and the section is skipped at render.
+
+### Never
+
+- Never add a wide "update companySettings" helper — the per-setting functions exist so an unrelated form can't blank a neighboring flag.
+- Never persist or log a raw API key; only `keyHash` / `keyPreview` are stored, and the raw value is returned to the caller exactly once on create.
+- Never re-export the `*.server.ts` files from `index.ts`. The barrel is `backups.service`, `settings.models`, `settings.service`, `types`, `ui` only — `settings.server.ts` (Redis + `@carbon/ee`), `backups.server.ts`, `backups-archive.server.ts`, `documentPreview.server.ts`, and `labelLogo.server.ts` are deep-imported by path (e.g. `~/modules/settings/documentPreview.server`) to keep server-only deps out of client bundles.
+
+## Validation Commands
+
+```bash
+pnpm exec turbo run typecheck --filter=erp
+pnpm exec turbo run typecheck --filter=@carbon/documents # when touching template types
+pnpm run test
+pnpm run lint
+```
+
+## Key Data Model
+
+| Table / View | Purpose |
+|---|---|
+| `company` | Company/subsidiary master: address, tax ids, `companyGroupId`, all five logo columns |
+| `companies` (view) | User↔company membership with `userId` / `role`; source for the company picker |
+| `companySettings` | Per-company flags/JSON (PK `id` = company id) |
+| `companyPlan` / `plan` | Stripe subscription state and plan catalog |
+| `config` / `industry` | Global config row; onboarding industry catalog (`active`, `sortOrder`) |
+| `documentTemplate` | Block layout + theme + settings per `(companyId, documentType)` |
+| `documentSection` | Company-global reusable header/body/footer rich text |
+| `terms` | Company `salesTerms` / `purchasingTerms` JSON (PK = company id) |
+| `sequence` | Readable-id numbering per table |
+| `itemSerialSequence` / `itemSerialSequences` (view) | Per-item serial-number numbering |
+| `customField` / `customFieldTables` (view) | User-defined fields, grouped per table |
+| `companyIntegration` / `integrations` (view) | Per-company third-party config + metadata |
+| `apiKey` | Hashed API keys with per-module scopes |
+| `webhook` / `webhookTable` | Outbound webhooks and the tables they may subscribe to |
+| `companyAccountsPayableBillingAddress` / `companyAccountsReceivableBillingAddress` | Remit-to / bill-to addresses printed on documents |
+| `employeeType` / `employeeTypePermission` / `employee` | Written only by `updateConsoleSetting`, which provisions a "Console Operator" type |
+
+## Key Service Functions
+
+- `getCompanySettings` / `getCompany` / `getCompanies` / `getEmployeeCompanies` — the reads the rest of the app depends on (~78 files read company settings)
+- `getNextSequence` (RPC `get_next_sequence`) / `getCurrentSequence` / `getSequence(s)` / `updateSequence` — document numbering
+- `getDocumentTemplate` / `getDocumentTemplateConfig` / `upsertDocumentTemplate` — template read/write
+- `getDocumentSections` / `getDocumentSectionsByIds` / `upsertDocumentSection` / `deleteDocumentSection` / `resolveSections` — sections; `resolveSections` seeds built-ins first, then lets a stored row of the same id override
+- `getTerms` — company terms fallback for the Terms block; `getAccountsPayableBillingAddress` / `getAccountsReceivableBillingAddress` (+ `update*`) — addresses printed on documents
+- `getCustomField(s)` / `getCustomFieldsTables`, plus `upsertCustomField` / `deleteCustomField` / `updateCustomFieldsSortOrder` (`settings.server.ts`, cache-clearing)
+- `getIntegration(s)` / `getCompanyIntegrations` / `upsertCompanyIntegration` / `deactivateIntegration` / `getIntegrationsWithHealth`
+- `upsertApiKey` / `deleteApiKey`; `upsertWebhook` / `deleteWebhook` / `deactivateWebhooks` / `getWebhookTables`
+- `insertCompany` / `insertSubsidiary` / `updateSubsidiary` / `deleteSubsidiary` / `seedCompany` / `updateCompany` / `updateCompanyPlan`
+- `updateLogoLight|LightIcon|Dark|DarkIcon|Watermark` — store the storage path on `company`, not a URL (readers prefix it)
+- `exportCompanyBackup` / `listCompanyBackups` / `deleteCompanyBackup` / `getCompanyRestoreRuns` / `getCompanyExportRun` (`backups.service.ts`); restore triggers live in `backups.server.ts`
+- `resolveLabelLogo` (`labelLogo.server.ts`) — binds `@carbon/documents/labels`' resolver to this app's `SUPABASE_URL`; used by every ERP `file+/**/$id.labels[.]pdf|zpl` route (MES keeps its own copy at `apps/mes/app/services/labelLogo.server.ts`)
+
+## Document Preview
+
+`documentPreview.server.ts` lets the template editor render a draft layout against a **real record** instead of sample data. Two exports, both deep-imported (never via the barrel):
+
+- `listPreviewEntities(client, companyId, documentType)` — populates the editor's record picker. `LIST_CONFIG` is the gate: a document type absent from the map returns `[]` and can only preview sample data. Each entry is `{ view, idColumn, hasRevision? }` — currently `salesInvoice`→`salesInvoices`, `salesOrder`→`salesOrders`, `purchaseOrder`→`purchaseOrders`, `quote`→`quotes`, `stockTransfer`→`stockTransfer`. It selects the six most recent rows by `createdAt`, scoped by `companyId`.
+- `hasRevision` marks the types whose records are revised — currently `purchaseOrder` and `quote`. It gates selecting `revisionId` (only those views carry the column, so requesting it from `salesInvoices` / `stockTransfer` would error) and switches the label to `withRevisionSuffix` (`@carbon/documents/utils`), so two revisions sharing one readable id don't render as indistinguishable options. Sales orders are deliberately excluded: the column exists but nothing writes it.
+- `buildPreviewProps(client, companyId, companyGroupId, documentType, id, locale)` — mirrors the live PDF route loaders per type, returning the exact prop bag that document's PDF expects, or `null` when the type is unsupported or the record is missing (the caller then falls back to sample data). It always fetches `getCompany` + `getCompanySettings` as a base, gates the AP/AR billing address on the corresponding `companySettings` flag, and for `quote` additionally resolves an `exchangeRate` via `getCurrencyByCode`. Because it pulls readers from accounting, inventory, invoicing, purchasing, sales, and settings, **adding a preview-able document type means adding both a `LIST_CONFIG` entry and a `switch` arm**.
+
+Consumers: `x+/templates+/$type.tsx` (loader → picker) and `x+/templates+/$type.preview.tsx` (action → `DOCUMENT_PDFS` → `renderToStream`). Both gate on `view: "settings"`; template saves need `update: "settings"`.
+
+## Key Exports
+
+```typescript
+import { getCompanySettings, getNextSequence, getDocumentTemplateConfig } from "~/modules/settings";
+import { companyValidator, sequenceValidator, documentTemplateValidator } from "~/modules/settings";
+import { buildPreviewProps } from "~/modules/settings/documentPreview.server"; // server-only, by path
+```
+
+## Related Modules
+
+- **shared** — `getCustomFieldsSchemas` (`shared.server.ts`) reads the fields defined here; `getApprovalRules` backs the Approval Rules UI that lives in `settings/ui/Approvals`
+- **users** — ITAR certification data (`getItarCertificationReport`) rendered by `settings/ui/ItarCertifications`
+- **accounting / invoicing / purchasing / sales / inventory** — consume `getNextSequence` and `getCompanySettings`, and supply every reader `buildPreviewProps` calls
+- **items** — `itemSerialSequence` numbering; `plmReleaseControl` validator imported from `items.models`
+- **`@carbon/printing`** — `printerRouteValidator` / `updateAssignmentValidator` are re-exported from `settings.models.ts`; **`@carbon/ee`** supplies the integration configs and server hooks `settings.server.ts` uses
+
+## Rules References
+
+- `.claude/rules/document-template-customizer.md` — block schema, `resolveTemplate`, section forking, render path
+- `.claude/rules/company-backup-restore.md` — export/restore jobs, access gate, storage layout
+- `.claude/rules/printing-system.md` — printer routing and the queued label path
+- `.claude/rules/audit-log-system.md` — the audit-log settings surface under `settings/ui/AuditLog`
+- `.claude/rules/conventions-services.md` — service function shape and naming
diff --git a/apps/erp/app/modules/settings/documentPreview.server.ts b/apps/erp/app/modules/settings/documentPreview.server.ts
index 5a4f39f67b..d5a358f00b 100644
--- a/apps/erp/app/modules/settings/documentPreview.server.ts
+++ b/apps/erp/app/modules/settings/documentPreview.server.ts
@@ -1,4 +1,5 @@
import type { Database } from "@carbon/database";
+import { withRevisionSuffix } from "@carbon/documents/utils";
import type { JSONContent } from "@carbon/react";
import type { SupabaseClient } from "@supabase/supabase-js";
import { getCurrencyByCode, getPaymentTermsList } from "~/modules/accounting";
@@ -45,18 +46,35 @@ export interface PreviewEntity {
label: string;
}
-/** Document types that support previewing against a real record. */
+/**
+ * Document types that support previewing against a real record.
+ *
+ * `hasRevision` marks the types whose records are revised — two revisions share
+ * a readable id, so the picker must label them apart. It also gates selecting
+ * `revisionId`, which only some of these views carry. Sales orders are NOT
+ * revised (the column exists but nothing writes it), so they stay off.
+ */
const LIST_CONFIG: Record<
string,
- { view: string; idColumn: string } | undefined
+ { view: string; idColumn: string; hasRevision?: boolean } | undefined
> = {
salesInvoice: { view: "salesInvoices", idColumn: "invoiceId" },
salesOrder: { view: "salesOrders", idColumn: "salesOrderId" },
- purchaseOrder: { view: "purchaseOrders", idColumn: "purchaseOrderId" },
- quote: { view: "quotes", idColumn: "quoteId" },
+ purchaseOrder: {
+ view: "purchaseOrders",
+ idColumn: "purchaseOrderId",
+ hasRevision: true
+ },
+ quote: { view: "quotes", idColumn: "quoteId", hasRevision: true },
stockTransfer: { view: "stockTransfer", idColumn: "stockTransferId" }
};
+/** Shape `listPreviewEntities` reads back; `revisionId` only when requested. */
+type PreviewRow = {
+ id: string;
+ revisionId?: number | null;
+} & Record<string, string | number | null | undefined>;
+
/** Recent records of a document type, to populate the preview record picker. */
export async function listPreviewEntities(
client: Client,
@@ -68,15 +86,29 @@ export async function listPreviewEntities(
const { data } = await client
.from(cfg.view as never)
- .select(`id, ${cfg.idColumn}`)
+ .select(
+ cfg.hasRevision
+ ? `id, ${cfg.idColumn}, revisionId`
+ : `id, ${cfg.idColumn}`
+ )
.eq("companyId", companyId)
.order("createdAt", { ascending: false })
// Just the latest handful — the picker is for sampling, not browsing.
.limit(6);
- return ((data ?? []) as Record<string, string>[])
+ return ((data ?? []) as PreviewRow[])
.filter((row) => row.id)
- .map((row) => ({ id: row.id, label: row[cfg.idColumn] ?? row.id }));
+ .map((row) => {
+ const readableId = row[cfg.idColumn];
+ return {
+ id: row.id,
+ label:
+ withRevisionSuffix(
+ typeof readableId === "string" ? readableId : null,
+ row.revisionId
+ ) || row.id
+ };
+ });
}
const emptyThumbnails: Record<string, string | null> = {};
diff --git a/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json b/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json
index 126ed94225..aa813ea572 100644
--- a/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json
+++ b/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json
@@ -1,6 +1,6 @@
{
- "generated": "2026-08-18T07:59:22.902Z",
- "totalTools": 1443,
+ "generated": "2026-08-18T19:07:39.197Z",
+ "totalTools": 1444,
"modules": 15,
"tools": [
{
@@ -26937,6 +26937,31 @@
]
}
},
+ {
+ "name": "purchasing_reopenPurchaseOrderAsRevision",
+ "module": "purchasing",
+ "classification": "WRITE",
+ "description": "reopen purchase order as revision",
+ "paramCount": 1,
+ "serviceParams": [
+ "db",
+ "{\n id,\n companyId,\n updatedBy\n }"
+ ],
+ "injectAuth": [
+ "companyId"
+ ],
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "id"
+ ]
+ }
+ },
{
"name": "purchasing_updateSupplierAccounting",
"module": "purchasing",
diff --git a/apps/erp/app/routes/file+/purchase-order+/$orderId[.]pdf.tsx b/apps/erp/app/routes/file+/purchase-order+/$orderId[.]pdf.tsx
index 2e591ca679..1368e13a17 100644
--- a/apps/erp/app/routes/file+/purchase-order+/$orderId[.]pdf.tsx
+++ b/apps/erp/app/routes/file+/purchase-order+/$orderId[.]pdf.tsx
@@ -1,5 +1,9 @@
import { requirePermissions } from "@carbon/auth/auth.server";
-import { ensureFont, PurchaseOrderPDF } from "@carbon/documents/pdf";
+import {
+ ensureFont,
+ getPurchaseOrderDisplayId,
+ PurchaseOrderPDF
+} from "@carbon/documents/pdf";
import {
collectSectionIds,
resolveTemplate,
@@ -197,7 +201,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const headers = new Headers({
"Content-Type": "application/pdf",
- "Content-Disposition": `inline; filename="${company.data.name} - ${purchaseOrder.data.purchaseOrderId}.pdf"`
+ "Content-Disposition": `inline; filename="${company.data.name} - ${getPurchaseOrderDisplayId(purchaseOrder.data)}.pdf"`
});
return new Response(new Uint8Array(body), { status: 200, headers });
}
diff --git a/apps/erp/app/routes/file+/quote+/$id[.]pdf.tsx b/apps/erp/app/routes/file+/quote+/$id[.]pdf.tsx
index 498dd23321..394b1cdbdc 100644
--- a/apps/erp/app/routes/file+/quote+/$id[.]pdf.tsx
+++ b/apps/erp/app/routes/file+/quote+/$id[.]pdf.tsx
@@ -1,5 +1,5 @@
import { requirePermissions } from "@carbon/auth/auth.server";
-import { ensureFont, QuotePDF } from "@carbon/documents/pdf";
+import { ensureFont, getQuoteDisplayId, QuotePDF } from "@carbon/documents/pdf";
import {
collectSectionIds,
resolveTemplate,
@@ -203,7 +203,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const headers = new Headers({
"Content-Type": "application/pdf",
- "Content-Disposition": `inline; filename="${company.data.name} - ${quote.data.quoteId}.pdf"`
+ "Content-Disposition": `inline; filename="${company.data.name} - ${getQuoteDisplayId(quote.data)}.pdf"`
});
return new Response(new Uint8Array(body), { status: 200, headers });
}
diff --git a/apps/erp/app/routes/share+/quote.$id.tsx b/apps/erp/app/routes/share+/quote.$id.tsx
index 640d291f09..6754fdec31 100644
--- a/apps/erp/app/routes/share+/quote.$id.tsx
+++ b/apps/erp/app/routes/share+/quote.$id.tsx
@@ -1,4 +1,5 @@
import { getCarbonServiceRole } from "@carbon/auth/client.server";
+import { getQuoteDisplayId } from "@carbon/documents/utils";
import { Input, ValidatedForm } from "@carbon/form";
import type { JSONContent } from "@carbon/react";
import {
@@ -247,7 +248,9 @@ const Header = ({
<div>
<CardTitle className="text-3xl">{company?.name ?? ""}</CardTitle>
{quote?.quoteId && (
- <p className="text-lg text-muted-foreground">{quote.quoteId}</p>
+ <p className="text-lg text-muted-foreground">
+ {getQuoteDisplayId(quote)}
+ </p>
)}
{quote?.expirationDate && (
<p className="text-lg text-muted-foreground">
@@ -1341,8 +1344,8 @@ const Quote = ({ data }: { data: QuoteData }) => {
</ModalTitle>
<ModalDescription>
<Trans>
- Are you sure you want to accept quote {quote.quoteId} for{" "}
- {formatter.format(total)}?
+ Are you sure you want to accept quote{" "}
+ {getQuoteDisplayId(quote)} for {formatter.format(total)}?
</Trans>
</ModalDescription>
</ModalHeader>
diff --git a/apps/erp/app/routes/x+/purchase-order+/$orderId.finalize.tsx b/apps/erp/app/routes/x+/purchase-order+/$orderId.finalize.tsx
index ec7e7f84e9..576a4a257b 100644
--- a/apps/erp/app/routes/x+/purchase-order+/$orderId.finalize.tsx
+++ b/apps/erp/app/routes/x+/purchase-order+/$orderId.finalize.tsx
@@ -3,6 +3,7 @@ import { requirePermissions } from "@carbon/auth/auth.server";
import { getCarbonServiceRole } from "@carbon/auth/client.server";
import { flash } from "@carbon/auth/session.server";
import { PurchaseOrderEmail } from "@carbon/documents/email";
+import { getPurchaseOrderDisplayId } from "@carbon/documents/pdf";
import { validationError, validator } from "@carbon/form";
import { trigger } from "@carbon/jobs";
import { trackWorkEvent } from "@carbon/lib/telemetry";
@@ -237,7 +238,7 @@ export async function action(args: ActionFunctionArgs) {
file = await pdf.arrayBuffer();
fileName = stripSpecialCharacters(
- `${purchaseOrder.data.purchaseOrderId} - ${new Date()
+ `${getPurchaseOrderDisplayId(purchaseOrder.data)} - ${new Date()
.toISOString()
.slice(0, -5)}.pdf`
);
@@ -429,7 +430,7 @@ export async function action(args: ActionFunctionArgs) {
to: [buyer.data.email, supplier.data.contact.email],
cc: ccSelections?.length ? ccSelections : undefined,
from: buyer.data.email,
- subject: `Purchase Order ${purchaseOrder.data.purchaseOrderId} from ${company.data.name}`,
+ subject: `Purchase Order ${getPurchaseOrderDisplayId(purchaseOrder.data)} from ${company.data.name}`,
html,
text,
attachments: attachments.length ? attachments : undefined,
diff --git a/apps/erp/app/routes/x+/purchase-order+/$orderId.status.tsx b/apps/erp/app/routes/x+/purchase-order+/$orderId.status.tsx
index ca5ae9f7ab..f4bad05c6d 100644
--- a/apps/erp/app/routes/x+/purchase-order+/$orderId.status.tsx
+++ b/apps/erp/app/routes/x+/purchase-order+/$orderId.status.tsx
@@ -7,11 +7,14 @@ import type { ActionFunctionArgs } from "react-router";
import { redirect } from "react-router";
import { runMRP } from "~/modules/production";
import {
+ canCreatePurchaseOrderRevision,
isPurchaseOrderLocked,
purchaseOrderStatusType,
+ reopenPurchaseOrderAsRevision,
updatePurchaseOrderStatus
} from "~/modules/purchasing";
import { canApproveRequest } from "~/modules/shared";
+import { getDatabaseClient } from "~/services/database.server";
import { path, requestReferrer } from "~/utils/path";
const logger = getLogger("erp", "orderid-status");
@@ -41,13 +44,38 @@ export async function action({ request, params }: ActionFunctionArgs) {
const currentPo = await viewClient
.from("purchaseOrder")
- .select("status")
+ .select("status, orderDate")
.eq("id", id)
.single();
const currentStatus = currentPo.data?.status;
const isCurrentlyLocked = isPurchaseOrderLocked(currentStatus);
+ // Explicit request only — a plain Reopen never bumps.
+ const createRevisionRequested =
+ status === "Draft" && formData.get("createRevision") === "true";
+
+ // Reject an ineligible revision BEFORE the Draft branch below cancels pending
+ // approvals: those side effects must not be applied for a request that is
+ // about to fail. reopenPurchaseOrderAsRevision re-checks the same conditions
+ // in SQL, so this is a pre-flight, not the authority.
+ if (
+ createRevisionRequested &&
+ !canCreatePurchaseOrderRevision({
+ newStatus: status,
+ currentStatus,
+ orderDate: currentPo.data?.orderDate
+ })
+ ) {
+ throw redirect(
+ requestReferrer(request) ?? path.to.purchaseOrder(id),
+ await flash(
+ request,
+ error(null, "Only a released purchase order can be revised")
+ )
+ );
+ }
+
// Determine required permission:
// - Reopening (Draft) from a locked status requires delete permission
// - Closing from any status requires delete permission
@@ -157,6 +185,38 @@ export async function action({ request, params }: ActionFunctionArgs) {
}
}
+ if (createRevisionRequested) {
+ let rowsUpdated = 0;
+ try {
+ rowsUpdated = await reopenPurchaseOrderAsRevision(getDatabaseClient(), {
+ id,
+ companyId,
+ updatedBy: userId
+ });
+ } catch (err) {
+ logger.error("Failed to create purchase order revision", { error: err });
+ throw redirect(
+ requestReferrer(request) ?? path.to.purchaseOrder(id),
+ await flash(request, error(err, "Failed to create revision"))
+ );
+ }
+
+ if (rowsUpdated === 0) {
+ throw redirect(
+ requestReferrer(request) ?? path.to.purchaseOrder(id),
+ await flash(
+ request,
+ error(null, "Only a released purchase order can be revised")
+ )
+ );
+ }
+
+ throw redirect(
+ requestReferrer(request) ?? path.to.purchaseOrder(id),
+ await flash(request, success("Created a new purchase order revision"))
+ );
+ }
+
const update = await updatePurchaseOrderStatus(client, {
id,
status,
diff --git a/apps/erp/app/routes/x+/purchase-order+/$orderId.tsx b/apps/erp/app/routes/x+/purchase-order+/$orderId.tsx
index 89e0b685de..8c87bd9d75 100644
--- a/apps/erp/app/routes/x+/purchase-order+/$orderId.tsx
+++ b/apps/erp/app/routes/x+/purchase-order+/$orderId.tsx
@@ -3,6 +3,7 @@ import { requirePermissions } from "@carbon/auth/auth.server";
import { getCarbonServiceRole } from "@carbon/auth/client.server";
import { flash } from "@carbon/auth/session.server";
import { PurchaseOrderEmail } from "@carbon/documents/email";
+import { getPurchaseOrderDisplayId } from "@carbon/documents/pdf";
import { validationError, validator } from "@carbon/form";
import { trigger } from "@carbon/jobs";
import { getLogger } from "@carbon/logger";
@@ -213,7 +214,7 @@ export async function action(args: ActionFunctionArgs) {
if (pdf.headers.get("content-type") === "application/pdf") {
const file = await pdf.arrayBuffer();
fileName = stripSpecialCharacters(
- `${purchaseOrder.data.purchaseOrderId} - ${new Date()
+ `${getPurchaseOrderDisplayId(purchaseOrder.data)} - ${new Date()
.toISOString()
.slice(0, -5)}.pdf`
);
@@ -325,7 +326,7 @@ export async function action(args: ActionFunctionArgs) {
to: [buyer.data.email, supplierEmail],
cc: ccSelections?.length ? ccSelections : undefined,
from: buyer.data.email,
- subject: `Purchase Order ${purchaseOrder.data.purchaseOrderId} from ${company.data.name}`,
+ subject: `Purchase Order ${getPurchaseOrderDisplayId(purchaseOrder.data)} from ${company.data.name}`,
html,
text,
attachments: signedUrlData?.signedUrl
diff --git a/apps/erp/app/routes/x+/quote+/$quoteId.finalize.tsx b/apps/erp/app/routes/x+/quote+/$quoteId.finalize.tsx
index 651ad56a31..a25c9bb663 100644
--- a/apps/erp/app/routes/x+/quote+/$quoteId.finalize.tsx
+++ b/apps/erp/app/routes/x+/quote+/$quoteId.finalize.tsx
@@ -2,6 +2,7 @@ import { assertIsPost, error, success } from "@carbon/auth";
import { requirePermissions } from "@carbon/auth/auth.server";
import { flash } from "@carbon/auth/session.server";
import { QuoteEmail } from "@carbon/documents/email";
+import { getQuoteDisplayId } from "@carbon/documents/pdf";
import { validationError, validator } from "@carbon/form";
import { trigger } from "@carbon/jobs";
import { datetime } from "@carbon/utils";
@@ -74,7 +75,9 @@ export async function action(args: ActionFunctionArgs) {
file = await pdf.arrayBuffer();
fileName = stripSpecialCharacters(
- `${quote.data.quoteId} - ${new Date().toISOString().slice(0, -5)}.pdf`
+ `${getQuoteDisplayId(quote.data)} - ${new Date()
+ .toISOString()
+ .slice(0, -5)}.pdf`
);
documentFilePath = `${companyId}/opportunity/${quote.data.opportunityId}/${fileName}`;
@@ -197,7 +200,7 @@ export async function action(args: ActionFunctionArgs) {
to: [user.data.email, customerContact.data.contact!.email!],
cc: ccSelections?.length ? ccSelections : undefined,
from: user.data.email,
- subject: `Quote ${quote.data.quoteId}`,
+ subject: `Quote ${getQuoteDisplayId(quote.data)}`,
html,
text,
attachments: signedUrlData?.signedUrl
diff --git a/packages/database/supabase/functions/get-method/index.ts b/packages/database/supabase/functions/get-method/index.ts
index aa8dd129bc..c052acf6a2 100644
--- a/packages/database/supabase/functions/get-method/index.ts
+++ b/packages/database/supabase/functions/get-method/index.ts
@@ -5861,13 +5861,29 @@ serve(async (req: Request) => {
quoteId = await getNextSequence(trx, "quote", companyId);
}
+ // Each revision needs its own link row (the share page resolves a
+ // quote by externalLinkId), but documentId is unique per document —
+ // qualify it with the revision so a revision of Q000001 doesn't
+ // collide with the original's link.
+ //
+ // A conflict here can only mean an ORPHAN: revisions are numbered
+ // max(revisionId) + 1, so this documentId can't belong to a live
+ // quote — the previous holder was deleted and deleteQuote leaves the
+ // link row behind. Reuse it rather than failing the whole copy.
+ const linkDocumentId =
+ revisionId > 0 ? `${quoteId}-${revisionId}` : quoteId;
const externalLinkId = await trx
.insertInto("externalLink")
.values({
- documentId: quoteId,
+ documentId: linkDocumentId,
documentType: "Quote",
companyId,
})
+ .onConflict((oc) =>
+ oc
+ .columns(["documentId", "documentType", "companyId"])
+ .doUpdateSet({ documentId: linkDocumentId })
+ )
.returning(["id"])
.executeTakeFirstOrThrow();
diff --git a/packages/documents/AGENTS.md b/packages/documents/AGENTS.md
index ec19f6caf2..635d7e0a06 100644
--- a/packages/documents/AGENTS.md
+++ b/packages/documents/AGENTS.md
@@ -36,7 +36,8 @@ pnpm --filter @carbon/documents build # generates fonts.data.ts
- **Block shape**: `({ block, data }) => JSX.Element | null`, keyed in per-doc `registry.tsx`
- **Fonts**: bundled as base64 woff in gitignored `pdf/fonts.data.ts`, generated by `scripts/generate-fonts.mjs`
- **Email previews**: `src/email/previews/` holds **one fixture per shipped email** — every `NotificationEvent` that sends mail (except `Digest`, which is in-app only), plus the transactional and lifecycle templates. Fixtures are not shipped (not exported from `index.ts`). `pnpm email:previews` is the only way to view them — it serves the react-email dev server over that folder on `EMAIL_DEV_PORT`, and is what `crbn up`'s Email app runs. Point `email-dev.mjs` at `./src/email` by hand if you ever need the bare templates, but the four document emails error there (their props are DB view rows). The per-event `NotificationEmail` fixtures are generated: edit the `previews` array in `scripts/generate-notification-previews.mjs`, re-run it, then `biome check --write` the folder (the generator emits raw JSON indentation)
-- **Exports**: `./pdf`, `./email`, `./template`, `./zpl`, `./qr`, `./labels`
+- **Exports**: `./pdf`, `./email`, `./template`, `./zpl`, `./qr`, `./labels`, `./utils`
+- **`./utils` is the CLIENT-SAFE entry point** — pure display helpers with type-only deps: `withRevisionSuffix(readableId, revisionId)` is the one place the `PO000123-1` format is defined, and `getPurchaseOrderDisplayId` / `getQuoteDisplayId` are the entity-shaped wrappers that delegate to it. Browser code (ERP UI, the `/share/**` pages) must import from here, NOT from `./pdf`, which pulls the whole react-pdf graph into the bundle. `src/utils/index.ts` is deliberately an explicit re-export list, not `export *`: the per-document util files each define their own `getLineDescription`
## Cross-References
diff --git a/packages/documents/package.json b/packages/documents/package.json
index a5358cfacb..f4ed79a432 100644
--- a/packages/documents/package.json
+++ b/packages/documents/package.json
@@ -45,7 +45,8 @@
"./template": "./src/template/index.ts",
"./zpl": "./src/zpl/index.ts",
"./qr": "./src/qr/qr-code.ts",
- "./labels": "./src/labels/index.ts"
+ "./labels": "./src/labels/index.ts",
+ "./utils": "./src/utils/index.ts"
},
"private": true,
"scripts": {
diff --git a/packages/documents/src/email/PurchaseOrderEmail.tsx b/packages/documents/src/email/PurchaseOrderEmail.tsx
index 666ecc066b..b8722892ce 100644
--- a/packages/documents/src/email/PurchaseOrderEmail.tsx
+++ b/packages/documents/src/email/PurchaseOrderEmail.tsx
@@ -15,6 +15,7 @@ import type { Email } from "../types";
import {
getLineDescription,
getLineDescriptionDetails,
+ getPurchaseOrderDisplayId,
getTotal
} from "../utils/purchase-order";
import { getMoneyFormatter } from "../utils/shared";
@@ -71,7 +72,7 @@ const PurchaseOrderEmail = ({
purchaseOrder.currencyCode ?? company.baseCurrencyCode ?? "USD"
);
const preview = (
- <Preview>{`${purchaseOrder.purchaseOrderId} from ${company.name}`}</Preview>
+ <Preview>{`${getPurchaseOrderDisplayId(purchaseOrder)} from ${company.name}`}</Preview>
);
const themeClasses = getEmailThemeClasses();
const lightStyles = getEmailInlineStyles("light");
@@ -159,7 +160,7 @@ const PurchaseOrderEmail = ({
>
Order ID
</Text>
- <Text>{purchaseOrder.purchaseOrderId}</Text>
+ <Text>{getPurchaseOrderDisplayId(purchaseOrder)}</Text>
</Column>
<Column>
<Text
diff --git a/packages/documents/src/email/QuoteEmail.tsx b/packages/documents/src/email/QuoteEmail.tsx
index 212f641096..c57b282653 100644
--- a/packages/documents/src/email/QuoteEmail.tsx
+++ b/packages/documents/src/email/QuoteEmail.tsx
@@ -12,6 +12,7 @@ import {
Text
} from "@react-email/components";
import type { CompanySettings, Email } from "../types";
+import { getQuoteDisplayId } from "../utils/quote";
import ExternalNotes from "./components/ExternalNotes";
import {
Button,
@@ -38,7 +39,9 @@ const QuoteEmail = ({
? `${getAppUrl()}/share/quote/${quote.externalLinkId}` // the VERCEL_URL variable was giving us a preview branch
: undefined;
- const preview = <Preview>{`${quote.quoteId} from ${company.name}`}</Preview>;
+ const preview = (
+ <Preview>{`${getQuoteDisplayId(quote)} from ${company.name}`}</Preview>
+ );
const themeClasses = getEmailThemeClasses();
const lightStyles = getEmailInlineStyles("light");
@@ -128,7 +131,7 @@ const QuoteEmail = ({
>
Quote ID
</Text>
- <Text>{quote.quoteId}</Text>
+ <Text>{getQuoteDisplayId(quote)}</Text>
</Column>
<Column>
<Text
diff --git a/packages/documents/src/pdf/PurchaseOrderPDF.tsx b/packages/documents/src/pdf/PurchaseOrderPDF.tsx
index d142bb80f1..638c6fedfb 100644
--- a/packages/documents/src/pdf/PurchaseOrderPDF.tsx
+++ b/packages/documents/src/pdf/PurchaseOrderPDF.tsx
@@ -8,6 +8,7 @@ import {
resolveTemplate
} from "../template";
import type { AccountsPayableBillingAddress, PDF } from "../types";
+import { getPurchaseOrderDisplayId } from "../utils/purchase-order";
import {
getMoneyFormatter,
getRateFormatter,
@@ -63,9 +64,10 @@ const PurchaseOrderPDF = ({
// getRateFormatter. Totals/tax/shipping stay on numberFormatter.
const rateFormatter = getRateFormatter(locale, currencyDecimals);
- const headerTitle = purchaseOrder?.purchaseOrderId
- ? `${title}: ${purchaseOrder.purchaseOrderId}`
- : title;
+ const displayId = purchaseOrder
+ ? getPurchaseOrderDisplayId(purchaseOrder)
+ : "";
+ const headerTitle = displayId ? `${title}: ${displayId}` : title;
const { blocks, theme, settings, headerSectionId, footerSectionId } =
resolveTemplate("purchaseOrder", template);
@@ -138,7 +140,7 @@ const PurchaseOrderPDF = ({
keywords: meta?.keywords ?? "purchase order",
subject: meta?.subject ?? "Purchase Order"
}}
- footerDocumentId={purchaseOrder?.purchaseOrderId}
+ footerDocumentId={displayId || undefined}
footerLabel={registration.label}
showFooter={showFooter}
showPageNumbers={settings.showPageNumbers}
diff --git a/packages/documents/src/pdf/QuotePDF.tsx b/packages/documents/src/pdf/QuotePDF.tsx
index 6c06c69c3a..45ea93912b 100644
--- a/packages/documents/src/pdf/QuotePDF.tsx
+++ b/packages/documents/src/pdf/QuotePDF.tsx
@@ -8,6 +8,7 @@ import {
resolveTemplate
} from "../template";
import type { AccountsReceivableBillingAddress, PDF } from "../types";
+import { getQuoteDisplayId } from "../utils/quote";
import { getMoneyFormatter, resolveRegistrationLine } from "../utils/shared";
import type { QuoteCustomerDetails, QuoteData } from "./blocks/quote";
import { buildQuoteVars, quoteBlockRegistry } from "./blocks/quote";
@@ -219,16 +220,18 @@ const QuotePDF = ({
(block) => block.visible && !(block.type === "header" && !showHeader)
);
+ const displayId = getQuoteDisplayId(quote);
+
return (
<Template
theme={theme}
- title={title}
+ title={displayId ? `${title}: ${displayId}` : title}
meta={{
author: meta?.author ?? "Carbon",
keywords: meta?.keywords ?? "quote",
subject: meta?.subject ?? "Quote"
}}
- footerDocumentId={quote?.quoteId}
+ footerDocumentId={displayId || undefined}
footerLabel={registration.label}
showFooter={showFooter}
showPageNumbers={settings.showPageNumbers}
diff --git a/packages/documents/src/pdf/blocks/purchaseOrder/HeaderBlock.tsx b/packages/documents/src/pdf/blocks/purchaseOrder/HeaderBlock.tsx
index 0760dca672..19096715b4 100644
--- a/packages/documents/src/pdf/blocks/purchaseOrder/HeaderBlock.tsx
+++ b/packages/documents/src/pdf/blocks/purchaseOrder/HeaderBlock.tsx
@@ -1,3 +1,4 @@
+import { getPurchaseOrderDisplayId } from "../../../utils/purchase-order";
import { Header } from "../../components";
import type { PurchaseOrderData } from "./types";
@@ -6,7 +7,11 @@ export function HeaderBlock({ data }: { data: PurchaseOrderData }) {
<Header
company={data.company}
title="Purchase Order"
- documentId={data.purchaseOrder?.purchaseOrderId}
+ documentId={
+ data.purchaseOrder
+ ? getPurchaseOrderDisplayId(data.purchaseOrder)
+ : undefined
+ }
locale={data.locale}
options={data.headerOptions}
fixed
diff --git a/packages/documents/src/pdf/blocks/purchaseOrder/vars.ts b/packages/documents/src/pdf/blocks/purchaseOrder/vars.ts
index bc0ab24c8a..fb1041c6b0 100644
--- a/packages/documents/src/pdf/blocks/purchaseOrder/vars.ts
+++ b/packages/documents/src/pdf/blocks/purchaseOrder/vars.ts
@@ -1,3 +1,4 @@
+import { getPurchaseOrderDisplayId } from "../../../utils/purchase-order";
import type { PurchaseOrderData } from "./types";
/** Merge-field variable map for a Purchase Order. */
@@ -12,7 +13,8 @@ export function buildPurchaseOrderVars(
const str = (v: unknown): string => (v == null ? "" : String(v));
return {
- "order.number": str(po?.purchaseOrderId),
+ "order.number": po ? getPurchaseOrderDisplayId(po) : "",
+ "order.revision": str(po?.revisionId ?? 0),
"order.date": str(po?.orderDate),
"order.supplierReference": str(po?.supplierReference),
"order.currency": str(data.currencyCode),
diff --git a/packages/documents/src/pdf/blocks/quote/HeaderBlock.tsx b/packages/documents/src/pdf/blocks/quote/HeaderBlock.tsx
index 13b90bd0aa..ee6f8ed61c 100644
--- a/packages/documents/src/pdf/blocks/quote/HeaderBlock.tsx
+++ b/packages/documents/src/pdf/blocks/quote/HeaderBlock.tsx
@@ -1,3 +1,4 @@
+import { getQuoteDisplayId } from "../../../utils/quote";
import { Header } from "../../components";
import type { QuoteData } from "./types";
@@ -6,7 +7,7 @@ export function HeaderBlock({ data }: { data: QuoteData }) {
<Header
company={data.company}
title="Quote"
- documentId={data.quote?.quoteId}
+ documentId={data.quote ? getQuoteDisplayId(data.quote) : undefined}
currencyCode={data.quote?.currencyCode}
locale={data.locale}
options={data.headerOptions}
diff --git a/packages/documents/src/pdf/blocks/quote/vars.ts b/packages/documents/src/pdf/blocks/quote/vars.ts
index 7a34020ec8..37bd85706c 100644
--- a/packages/documents/src/pdf/blocks/quote/vars.ts
+++ b/packages/documents/src/pdf/blocks/quote/vars.ts
@@ -1,3 +1,4 @@
+import { getQuoteDisplayId } from "../../../utils/quote";
import type { QuoteData } from "./types";
/** Merge-field variable map for a Quote. */
@@ -12,7 +13,8 @@ export function buildQuoteVars(
const str = (v: unknown): string => (v == null ? "" : String(v));
return {
- "quote.number": str(q?.quoteId),
+ "quote.number": q ? getQuoteDisplayId(q) : "",
+ "quote.revision": str(q?.revisionId ?? 0),
"quote.expirationDate": str(q?.expirationDate),
"quote.customerReference": str(q?.customerReference),
"quote.currency": str(data.currencyCode),
diff --git a/packages/documents/src/pdf/index.ts b/packages/documents/src/pdf/index.ts
index 794a9cbacf..768080f850 100644
--- a/packages/documents/src/pdf/index.ts
+++ b/packages/documents/src/pdf/index.ts
@@ -1,3 +1,5 @@
+import { getPurchaseOrderDisplayId } from "../utils/purchase-order";
+import { getQuoteDisplayId } from "../utils/quote";
import type { JobTravelerMaterial } from "./blocks/jobTraveler";
import { Footer } from "./components";
import { ensureFont, getSafeFontFamily, registerDocumentFonts } from "./fonts";
@@ -23,6 +25,8 @@ export {
DOCUMENT_PDFS,
ensureFont,
Footer,
+ getPurchaseOrderDisplayId,
+ getQuoteDisplayId,
getSafeFontFamily,
IssuePDF,
JobTravelerPageContent,
diff --git a/packages/documents/src/pdf/purchaseOrder.samples.ts b/packages/documents/src/pdf/purchaseOrder.samples.ts
index 22e28bc30b..b1e781ab99 100644
--- a/packages/documents/src/pdf/purchaseOrder.samples.ts
+++ b/packages/documents/src/pdf/purchaseOrder.samples.ts
@@ -18,6 +18,7 @@ export const SAMPLE_PURCHASE_ORDER = {
},
purchaseOrder: {
purchaseOrderId: "PO-001042",
+ revisionId: 0,
currencyCode: "USD",
orderDate: "2026-06-01",
supplierReference: "Q-55120",
diff --git a/packages/documents/src/pdf/quote.samples.ts b/packages/documents/src/pdf/quote.samples.ts
index 1f46b174bf..b7ec3752a5 100644
--- a/packages/documents/src/pdf/quote.samples.ts
+++ b/packages/documents/src/pdf/quote.samples.ts
@@ -18,6 +18,7 @@ export const SAMPLE_QUOTE = {
exchangeRate: 1,
quote: {
quoteId: "QUO-001042",
+ revisionId: 0,
currencyCode: "USD",
expirationDate: "2026-07-01",
customerReference: "RFQ-88421",
diff --git a/packages/documents/src/template/merge.ts b/packages/documents/src/template/merge.ts
index 73021ab6c8..e9c4a22c78 100644
--- a/packages/documents/src/template/merge.ts
+++ b/packages/documents/src/template/merge.ts
@@ -104,6 +104,7 @@ const SALES_ORDER_MERGE_FIELDS: MergeField[] = [
const PURCHASE_ORDER_MERGE_FIELDS: MergeField[] = [
{ token: "order.number", label: "PO Number", group: "Order" },
+ { token: "order.revision", label: "Revision", group: "Order" },
{ token: "order.date", label: "Order Date", group: "Order" },
{
token: "order.supplierReference",
@@ -120,6 +121,7 @@ const PURCHASE_ORDER_MERGE_FIELDS: MergeField[] = [
const QUOTE_MERGE_FIELDS: MergeField[] = [
{ token: "quote.number", label: "Quote Number", group: "Quote" },
+ { token: "quote.revision", label: "Revision", group: "Quote" },
{ token: "quote.expirationDate", label: "Expiration Date", group: "Quote" },
{
token: "quote.customerReference",
diff --git a/packages/documents/src/utils/index.ts b/packages/documents/src/utils/index.ts
new file mode 100644
index 0000000000..2b0682090a
--- /dev/null
+++ b/packages/documents/src/utils/index.ts
@@ -0,0 +1,6 @@
+// Client-safe: imported by browser code, so it must stay free of the react-pdf
+// graph `./pdf` pulls in. Not a wildcard barrel — the per-document util files
+// each export their own `getLineDescription`.
+export { getPurchaseOrderDisplayId } from "./purchase-order";
+export { getQuoteDisplayId } from "./quote";
+export { withRevisionSuffix } from "./revision";
diff --git a/packages/documents/src/utils/purchase-order.test.ts b/packages/documents/src/utils/purchase-order.test.ts
new file mode 100644
index 0000000000..9aa859cc95
--- /dev/null
+++ b/packages/documents/src/utils/purchase-order.test.ts
@@ -0,0 +1,19 @@
+import { describe, expect, it } from "vitest";
+import { getPurchaseOrderDisplayId } from "./purchase-order";
+
+// Suffix rules live in revision.test.ts; this pins field mapping only.
+describe("getPurchaseOrderDisplayId", () => {
+ it("reads purchaseOrderId and revisionId off the order", () => {
+ expect(
+ getPurchaseOrderDisplayId({ purchaseOrderId: "PO-001042", revisionId: 0 })
+ ).toBe("PO-001042");
+ expect(
+ getPurchaseOrderDisplayId({ purchaseOrderId: "PO-001042", revisionId: 2 })
+ ).toBe("PO-001042-2");
+ });
+
+ it("returns an empty string for a missing order", () => {
+ expect(getPurchaseOrderDisplayId(undefined)).toBe("");
+ expect(getPurchaseOrderDisplayId(null)).toBe("");
+ });
+});
diff --git a/packages/documents/src/utils/purchase-order.ts b/packages/documents/src/utils/purchase-order.ts
index b0297e8df3..2c0920b9a3 100644
--- a/packages/documents/src/utils/purchase-order.ts
+++ b/packages/documents/src/utils/purchase-order.ts
@@ -1,4 +1,5 @@
import type { Database } from "@carbon/database";
+import { withRevisionSuffix } from "./revision";
export function getLineDescription(
line: Database["public"]["Views"]["purchaseOrderLines"]["Row"]
@@ -56,3 +57,15 @@ export function getTotal(
) {
return lines.reduce((total, line) => total + getLineTotal(line), 0);
}
+
+export function getPurchaseOrderDisplayId(
+ purchaseOrder?: {
+ purchaseOrderId?: string | null;
+ revisionId?: number | null;
+ } | null
+) {
+ return withRevisionSuffix(
+ purchaseOrder?.purchaseOrderId,
+ purchaseOrder?.revisionId
+ );
+}
diff --git a/packages/documents/src/utils/quote.test.ts b/packages/documents/src/utils/quote.test.ts
new file mode 100644
index 0000000000..bacfd31106
--- /dev/null
+++ b/packages/documents/src/utils/quote.test.ts
@@ -0,0 +1,19 @@
+import { describe, expect, it } from "vitest";
+import { getQuoteDisplayId } from "./quote";
+
+// Suffix rules live in revision.test.ts; this pins field mapping only.
+describe("getQuoteDisplayId", () => {
+ it("reads quoteId and revisionId off the quote", () => {
+ expect(getQuoteDisplayId({ quoteId: "Q000001", revisionId: 0 })).toBe(
+ "Q000001"
+ );
+ expect(getQuoteDisplayId({ quoteId: "Q000001", revisionId: 2 })).toBe(
+ "Q000001-2"
+ );
+ });
+
+ it("returns an empty string for a missing quote", () => {
+ expect(getQuoteDisplayId(undefined)).toBe("");
+ expect(getQuoteDisplayId(null)).toBe("");
+ });
+});
diff --git a/packages/documents/src/utils/quote.ts b/packages/documents/src/utils/quote.ts
index d971a82880..915b45551e 100644
--- a/packages/documents/src/utils/quote.ts
+++ b/packages/documents/src/utils/quote.ts
@@ -1,4 +1,5 @@
import type { Database } from "@carbon/database";
+import { withRevisionSuffix } from "./revision";
export function getLineDescription(
line: Database["public"]["Views"]["quoteLines"]["Row"]
@@ -16,3 +17,12 @@ export function getLineDescriptionDetails(
) {
return line?.description ? `${line.description}` : "";
}
+
+export function getQuoteDisplayId(
+ quote?: {
+ quoteId?: string | null;
+ revisionId?: number | null;
+ } | null
+) {
+ return withRevisionSuffix(quote?.quoteId, quote?.revisionId);
+}
diff --git a/packages/documents/src/utils/revision.test.ts b/packages/documents/src/utils/revision.test.ts
new file mode 100644
index 0000000000..00d7017d6a
--- /dev/null
+++ b/packages/documents/src/utils/revision.test.ts
@@ -0,0 +1,21 @@
+import { describe, expect, it } from "vitest";
+import { withRevisionSuffix } from "./revision";
+
+describe("withRevisionSuffix", () => {
+ it("leaves the original bare", () => {
+ expect(withRevisionSuffix("PO-001042", 0)).toBe("PO-001042");
+ expect(withRevisionSuffix("PO-001042", null)).toBe("PO-001042");
+ expect(withRevisionSuffix("PO-001042", undefined)).toBe("PO-001042");
+ });
+
+ it("suffixes a revision", () => {
+ expect(withRevisionSuffix("PO-001042", 1)).toBe("PO-001042-1");
+ expect(withRevisionSuffix("Q000001", 12)).toBe("Q000001-12");
+ });
+
+ it("returns an empty string for a missing id, even with a revision", () => {
+ expect(withRevisionSuffix(null, 2)).toBe("");
+ expect(withRevisionSuffix(undefined, 2)).toBe("");
+ expect(withRevisionSuffix("", 2)).toBe("");
+ });
+});
diff --git a/packages/documents/src/utils/revision.ts b/packages/documents/src/utils/revision.ts
new file mode 100644
index 0000000000..f95dd2e34d
--- /dev/null
+++ b/packages/documents/src/utils/revision.ts
@@ -0,0 +1,11 @@
+/**
+ * The one definition of the revision suffix: `PO000123-1`. Revision 0 stays
+ * bare, and a missing id yields "" rather than a stray "-1".
+ */
+export function withRevisionSuffix(
+ readableId?: string | null,
+ revisionId?: number | null
+) {
+ if (!readableId) return "";
+ return (revisionId ?? 0) > 0 ? `${readableId}-${revisionId}` : readableId;
+}
diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.po
index fbc815ea67..d12a73faee 100644
--- a/packages/locale/locales/de/erp.po
+++ b/packages/locale/locales/de/erp.po
@@ -194,6 +194,10 @@ msgstr "{name} gelöscht"
msgid "{noDemandItemCount} parts skipped — nothing to make"
msgstr "{noDemandItemCount} Teile übersprungen — es gibt nichts zu produzieren"
+#. placeholder {0}: (routeData?.purchaseOrder?.revisionId ?? 0) + 1
+msgid "{orderLabel} will be reopened for editing as revision {0}. The document already sent to the supplier is unchanged until you finalize and resend the order."
+msgstr "{orderLabel} wird zur Bearbeitung als Überarbeitung {0} erneut geöffnet. Das bereits an den Lieferanten gesendete Dokument bleibt unverändert, bis Sie die Bestellung abschließen und erneut senden."
+
msgid "{remaining, plural, one {# phase left} other {# phases left}}"
msgstr "{remaining, plural, one {# Phase verbleibend} other {# Phasen verbleibend}}"
@@ -1695,7 +1699,7 @@ msgstr "Archiviert"
msgid "Archived Logs"
msgstr "Archivierte Protokolle"
-#. placeholder {0}: quote.quoteId
+#. placeholder {0}: getQuoteDisplayId(quote)
#. placeholder {1}: formatter.format(total)
msgid "Are you sure you want to accept quote {0} for {1}?"
msgstr "Sind Sie sicher, dass Sie das Angebot {0} für {1} akzeptieren möchten?"
@@ -1714,9 +1718,8 @@ msgstr "Sind Sie sicher, dass Sie {0} stornieren möchten? Es wird geschlossen u
msgid "Are you sure you want to cancel {0}? This will also cancel all related supplier quotes."
msgstr "Sind Sie sicher, dass Sie {0} stornieren möchten? Dies storniert auch alle zugehörigen Lieferantenofferten."
-#. placeholder {0}: routeData?.purchaseOrder?.purchaseOrderId ?? "this purchase order"
-msgid "Are you sure you want to cancel {0}? This will close the order."
-msgstr "Sind Sie sicher, dass Sie {0} stornieren möchten? Dadurch wird die Bestellung geschlossen."
+msgid "Are you sure you want to cancel {orderLabel}? This will close the order."
+msgstr "Sind Sie sicher, dass Sie {orderLabel} stornieren möchten? Dies wird die Bestellung schließen."
msgid "Are you sure you want to cancel this job? It will no longer be available on the shop floor."
msgstr "Sind Sie sicher, dass Sie diesen Auftrag stornieren möchten? Er ist dann nicht mehr auf der Werkstatt verfügbar."
@@ -1772,15 +1775,18 @@ msgstr "Sind Sie sicher, dass Sie {0} aus diesem Vorgang löschen möchten? Dies
msgid "Are you sure you want to delete {0}?"
msgstr "Sind Sie sicher, dass Sie {0} löschen möchten?"
+#. placeholder {0}: getQuoteDisplayId( routeData?.quote )
+#. placeholder {0}: getQuoteDisplayId( selectedQuotation )
#. placeholder {0}: initialValues.memoId
-#. placeholder {0}: initialValues.paymentId
-#. placeholder {0}: pickingList.pickingListId
msgid "Are you sure you want to delete {0}? This cannot be undone."
msgstr "Sind Sie sicher, dass Sie {0} löschen möchten? Dies kann nicht rückgängig gemacht werden."
msgid "Are you sure you want to delete {name}? This cannot be undone."
msgstr "Sind Sie sicher, dass Sie {name} löschen möchten? Dies kann nicht rückgängig gemacht werden."
+msgid "Are you sure you want to delete {orderLabel}? This cannot be undone."
+msgstr "Sind Sie sicher, dass Sie {orderLabel} löschen möchten? Dies kann nicht rückgängig gemacht werden."
+
#. placeholder {0}: activeView.name
#. placeholder {0}: viewPendingDelete.name
msgid "Are you sure you want to delete the \"{0}\" view? This cannot be undone."
@@ -2921,7 +2927,7 @@ msgid "Change Notices"
msgstr "Änderungsmitteilungen"
msgid "Change notices could not be loaded, so new versions and revisions are blocked. Reload to try again."
-msgstr ""
+msgstr "Änderungsmitteilungen konnten nicht geladen werden, daher sind neue Versionen und Überarbeitungen blockiert. Laden Sie neu, um es erneut zu versuchen."
msgid "Change order"
msgstr "Änderungsbestellung"
@@ -3899,6 +3905,9 @@ msgstr "Kanban erstellen"
msgid "Create new rule"
msgstr "Neue Regel erstellen"
+msgid "Create PO Revision"
+msgstr "Bestellungsrevision erstellen"
+
msgid "Create Production Event"
msgstr "Produktionsereignis erstellen"
@@ -15469,6 +15478,9 @@ msgstr "Dieser Pfad entscheidet nur darüber, was als nächstes ausgeführt wird
msgid "This period has no journal entries posted to it and can be permanently deleted. This cannot be undone."
msgstr "Diese Periode hat keine Journaleinträge und kann dauerhaft gelöscht werden. Dies kann nicht rückgängig gemacht werden."
+msgid "this purchase order"
+msgstr "diese Bestellung"
+
msgid "This Quarter"
msgstr "Dieses Quartal"
diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.po
index 0474168a33..d5cb14a7ca 100644
--- a/packages/locale/locales/en/erp.po
+++ b/packages/locale/locales/en/erp.po
@@ -194,6 +194,10 @@ msgstr "{name} deleted"
msgid "{noDemandItemCount} parts skipped — nothing to make"
msgstr "{noDemandItemCount} parts skipped — nothing to make"
+#. placeholder {0}: (routeData?.purchaseOrder?.revisionId ?? 0) + 1
+msgid "{orderLabel} will be reopened for editing as revision {0}. The document already sent to the supplier is unchanged until you finalize and resend the order."
+msgstr "{orderLabel} will be reopened for editing as revision {0}. The document already sent to the supplier is unchanged until you finalize and resend the order."
+
msgid "{remaining, plural, one {# phase left} other {# phases left}}"
msgstr "{remaining, plural, one {# phase left} other {# phases left}}"
@@ -1695,7 +1699,7 @@ msgstr "Archived"
msgid "Archived Logs"
msgstr "Archived Logs"
-#. placeholder {0}: quote.quoteId
+#. placeholder {0}: getQuoteDisplayId(quote)
#. placeholder {1}: formatter.format(total)
msgid "Are you sure you want to accept quote {0} for {1}?"
msgstr "Are you sure you want to accept quote {0} for {1}?"
@@ -1714,9 +1718,8 @@ msgstr "Are you sure you want to cancel {0}? It will be closed and read-only unt
msgid "Are you sure you want to cancel {0}? This will also cancel all related supplier quotes."
msgstr "Are you sure you want to cancel {0}? This will also cancel all related supplier quotes."
-#. placeholder {0}: routeData?.purchaseOrder?.purchaseOrderId ?? "this purchase order"
-msgid "Are you sure you want to cancel {0}? This will close the order."
-msgstr "Are you sure you want to cancel {0}? This will close the order."
+msgid "Are you sure you want to cancel {orderLabel}? This will close the order."
+msgstr "Are you sure you want to cancel {orderLabel}? This will close the order."
msgid "Are you sure you want to cancel this job? It will no longer be available on the shop floor."
msgstr "Are you sure you want to cancel this job? It will no longer be available on the shop floor."
@@ -1772,15 +1775,18 @@ msgstr "Are you sure you want to delete {0} from this operation? This cannot be
msgid "Are you sure you want to delete {0}?"
msgstr "Are you sure you want to delete {0}?"
+#. placeholder {0}: getQuoteDisplayId( routeData?.quote )
+#. placeholder {0}: getQuoteDisplayId( selectedQuotation )
#. placeholder {0}: initialValues.memoId
-#. placeholder {0}: initialValues.paymentId
-#. placeholder {0}: pickingList.pickingListId
msgid "Are you sure you want to delete {0}? This cannot be undone."
msgstr "Are you sure you want to delete {0}? This cannot be undone."
msgid "Are you sure you want to delete {name}? This cannot be undone."
msgstr "Are you sure you want to delete {name}? This cannot be undone."
+msgid "Are you sure you want to delete {orderLabel}? This cannot be undone."
+msgstr "Are you sure you want to delete {orderLabel}? This cannot be undone."
+
#. placeholder {0}: activeView.name
#. placeholder {0}: viewPendingDelete.name
msgid "Are you sure you want to delete the \"{0}\" view? This cannot be undone."
@@ -3899,6 +3905,9 @@ msgstr "Create Kanban"
msgid "Create new rule"
msgstr "Create new rule"
+msgid "Create PO Revision"
+msgstr "Create PO Revision"
+
msgid "Create Production Event"
msgstr "Create Production Event"
@@ -15469,6 +15478,9 @@ msgstr "This path only decides what runs next"
msgid "This period has no journal entries posted to it and can be permanently deleted. This cannot be undone."
msgstr "This period has no journal entries posted to it and can be permanently deleted. This cannot be undone."
+msgid "this purchase order"
+msgstr "this purchase order"
+
msgid "This Quarter"
msgstr "This Quarter"
diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.po
index 27b75fb505..14b070cfb7 100644
--- a/packages/locale/locales/es/erp.po
+++ b/packages/locale/locales/es/erp.po
@@ -194,6 +194,10 @@ msgstr "{name} eliminado"
msgid "{noDemandItemCount} parts skipped — nothing to make"
msgstr "{noDemandItemCount} piezas omitidas — no hay nada que fabricar"
+#. placeholder {0}: (routeData?.purchaseOrder?.revisionId ?? 0) + 1
+msgid "{orderLabel} will be reopened for editing as revision {0}. The document already sent to the supplier is unchanged until you finalize and resend the order."
+msgstr "{orderLabel} se reabrirá para edición como revisión {0}. El documento ya enviado al proveedor permanece sin cambios hasta que finalices y reenvíes la orden."
+
msgid "{remaining, plural, one {# phase left} other {# phases left}}"
msgstr "{remaining, plural, one {# fase restante} other {# fases restantes}}"
@@ -1695,7 +1699,7 @@ msgstr "Archivado"
msgid "Archived Logs"
msgstr "Registros Archivados"
-#. placeholder {0}: quote.quoteId
+#. placeholder {0}: getQuoteDisplayId(quote)
#. placeholder {1}: formatter.format(total)
msgid "Are you sure you want to accept quote {0} for {1}?"
msgstr "¿Estás seguro de que deseas aceptar la cotización {0} por {1}?"
@@ -1714,9 +1718,8 @@ msgstr "¿Estás seguro de que deseas cancelar {0}? Se cerrará y será de solo
msgid "Are you sure you want to cancel {0}? This will also cancel all related supplier quotes."
msgstr "¿Estás seguro de que deseas cancelar {0}? Esto también cancelará todas las cotizaciones de proveedores relacionadas."
-#. placeholder {0}: routeData?.purchaseOrder?.purchaseOrderId ?? "this purchase order"
-msgid "Are you sure you want to cancel {0}? This will close the order."
-msgstr "¿Está seguro de que desea cancelar {0}? Esto cerrará el pedido."
+msgid "Are you sure you want to cancel {orderLabel}? This will close the order."
+msgstr "¿Estás seguro de que deseas cancelar {orderLabel}? Esto cerrará la orden."
msgid "Are you sure you want to cancel this job? It will no longer be available on the shop floor."
msgstr "¿Estás seguro de que deseas cancelar este trabajo? Ya no estará disponible en el piso de producción."
@@ -1772,15 +1775,18 @@ msgstr "¿Está seguro de que desea eliminar {0} de esta operación? Esto no se
msgid "Are you sure you want to delete {0}?"
msgstr "¿Estás seguro de que deseas eliminar {0}?"
+#. placeholder {0}: getQuoteDisplayId( routeData?.quote )
+#. placeholder {0}: getQuoteDisplayId( selectedQuotation )
#. placeholder {0}: initialValues.memoId
-#. placeholder {0}: initialValues.paymentId
-#. placeholder {0}: pickingList.pickingListId
msgid "Are you sure you want to delete {0}? This cannot be undone."
msgstr "¿Estás seguro de que deseas eliminar {0}? Esto no se puede deshacer."
msgid "Are you sure you want to delete {name}? This cannot be undone."
msgstr "¿Estás seguro de que deseas eliminar {name}? Esto no se puede deshacer."
+msgid "Are you sure you want to delete {orderLabel}? This cannot be undone."
+msgstr "¿Estás seguro de que deseas eliminar {orderLabel}? Esto no se puede deshacer."
+
#. placeholder {0}: activeView.name
#. placeholder {0}: viewPendingDelete.name
msgid "Are you sure you want to delete the \"{0}\" view? This cannot be undone."
@@ -2921,7 +2927,7 @@ msgid "Change Notices"
msgstr "Avisos de Cambio"
msgid "Change notices could not be loaded, so new versions and revisions are blocked. Reload to try again."
-msgstr ""
+msgstr "No se pudieron cargar los avisos de cambio, por lo que las nuevas versiones y revisiones están bloqueadas. Recarga para intentar de nuevo."
msgid "Change order"
msgstr "Orden de cambio"
@@ -3899,6 +3905,9 @@ msgstr "Crear Kanban"
msgid "Create new rule"
msgstr "Crear nueva regla"
+msgid "Create PO Revision"
+msgstr "Crear Revisión de Orden de Compra"
+
msgid "Create Production Event"
msgstr "Crear Evento de Producción"
@@ -10658,7 +10667,7 @@ msgid "Packing Slip"
msgstr "Albarán de Empaque"
msgid "Pad amounts to their currency's decimal places, so 300 appears as 300.00 and columns of figures stay aligned. Turn this off to show only the digits that carry value. Printed documents and stored amounts are unaffected either way."
-msgstr "Rellenar los montos a las posiciones decimales de su moneda, de modo que 300 aparece como 300.00 y las columnas de cifras permanecen alineadas. Desactive esto para mostrar solo los dígitos que tienen valor. Los documentos impresos y los montos almacenados no se ven afectados de ninguna manera."
+msgstr "Rellenar los montos a las posiciones decimales de su moneda, de modo que 300 aparece como 300,00 y las columnas de cifras permanecen alineadas. Desactive esto para mostrar solo los dígitos que tienen valor. Los documentos impresos y los montos almacenados no se ven afectados de ninguna manera."
msgid "Page"
msgstr "Página"
@@ -15469,6 +15478,9 @@ msgstr "Esta ruta solo decide qué se ejecuta a continuación"
msgid "This period has no journal entries posted to it and can be permanently deleted. This cannot be undone."
msgstr "Este período no tiene asientos de diario registrados en él y puede eliminarse permanentemente. No se puede deshacer."
+msgid "this purchase order"
+msgstr "esta orden de compra"
+
msgid "This Quarter"
msgstr "Este Trimestre"
diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.po
index d4620ebf32..95551e1bad 100644
--- a/packages/locale/locales/fr/erp.po
+++ b/packages/locale/locales/fr/erp.po
@@ -194,6 +194,10 @@ msgstr "{name} supprimé"
msgid "{noDemandItemCount} parts skipped — nothing to make"
msgstr "{noDemandItemCount} pièces ignorées — rien à fabriquer"
+#. placeholder {0}: (routeData?.purchaseOrder?.revisionId ?? 0) + 1
+msgid "{orderLabel} will be reopened for editing as revision {0}. The document already sent to the supplier is unchanged until you finalize and resend the order."
+msgstr "{orderLabel} sera rouvert pour modification en tant que révision {0}. Le document déjà envoyé au fournisseur reste inchangé jusqu'à ce que vous le finalisiez et le renvoiez."
+
msgid "{remaining, plural, one {# phase left} other {# phases left}}"
msgstr "{remaining, plural, one {# phase restante} other {# phases restantes}}"
@@ -1695,7 +1699,7 @@ msgstr "Archivé"
msgid "Archived Logs"
msgstr "Journaux archivés"
-#. placeholder {0}: quote.quoteId
+#. placeholder {0}: getQuoteDisplayId(quote)
#. placeholder {1}: formatter.format(total)
msgid "Are you sure you want to accept quote {0} for {1}?"
msgstr "Êtes-vous sûr de vouloir accepter le devis {0} pour {1} ?"
@@ -1714,9 +1718,8 @@ msgstr "Êtes-vous sûr de vouloir annuler {0} ? Il sera fermé et en lecture se
msgid "Are you sure you want to cancel {0}? This will also cancel all related supplier quotes."
msgstr "Êtes-vous sûr de vouloir annuler {0} ? Cela annulera également tous les devis fournisseurs associés."
-#. placeholder {0}: routeData?.purchaseOrder?.purchaseOrderId ?? "this purchase order"
-msgid "Are you sure you want to cancel {0}? This will close the order."
-msgstr "Êtes-vous sûr de vouloir annuler {0} ? Cela fermera la commande."
+msgid "Are you sure you want to cancel {orderLabel}? This will close the order."
+msgstr "Êtes-vous sûr de vouloir annuler {orderLabel} ? Cela fermera la commande."
msgid "Are you sure you want to cancel this job? It will no longer be available on the shop floor."
msgstr "Êtes-vous sûr de vouloir annuler ce travail ? Il ne sera plus disponible sur l'atelier."
@@ -1772,15 +1775,18 @@ msgstr "Êtes-vous sûr de vouloir supprimer {0} de cette opération ? Cette act
msgid "Are you sure you want to delete {0}?"
msgstr "Êtes-vous sûr de vouloir supprimer {0} ?"
+#. placeholder {0}: getQuoteDisplayId( routeData?.quote )
+#. placeholder {0}: getQuoteDisplayId( selectedQuotation )
#. placeholder {0}: initialValues.memoId
-#. placeholder {0}: initialValues.paymentId
-#. placeholder {0}: pickingList.pickingListId
msgid "Are you sure you want to delete {0}? This cannot be undone."
msgstr "Êtes-vous sûr de vouloir supprimer {0} ? Cette action ne peut pas être annulée."
msgid "Are you sure you want to delete {name}? This cannot be undone."
msgstr "Êtes-vous sûr de vouloir supprimer {name} ? Cette action ne peut pas être annulée."
+msgid "Are you sure you want to delete {orderLabel}? This cannot be undone."
+msgstr "Êtes-vous sûr de vouloir supprimer {orderLabel} ? Cette action ne peut pas être annulée."
+
#. placeholder {0}: activeView.name
#. placeholder {0}: viewPendingDelete.name
msgid "Are you sure you want to delete the \"{0}\" view? This cannot be undone."
@@ -2921,7 +2927,7 @@ msgid "Change Notices"
msgstr "Avis de modification"
msgid "Change notices could not be loaded, so new versions and revisions are blocked. Reload to try again."
-msgstr ""
+msgstr "Les avis de modification n'ont pas pu être chargés, donc les nouvelles versions et révisions sont bloquées. Recharger pour réessayer."
msgid "Change order"
msgstr "Ordre de changement"
@@ -3899,6 +3905,9 @@ msgstr "Créer Kanban"
msgid "Create new rule"
msgstr "Créer une nouvelle règle"
+msgid "Create PO Revision"
+msgstr "Créer une révision de bon de commande"
+
msgid "Create Production Event"
msgstr "Créer un Événement de Production"
@@ -15469,6 +15478,9 @@ msgstr "Ce chemin décide seulement de ce qui s'exécute ensuite"
msgid "This period has no journal entries posted to it and can be permanently deleted. This cannot be undone."
msgstr "Cette période n'a aucune écriture de journal comptabilisée et peut être supprimée définitivement. Cela ne peut pas être annulé."
+msgid "this purchase order"
+msgstr "ce bon de commande"
+
msgid "This Quarter"
msgstr "Ce trimestre"
diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.po
index 165602489d..be3be7c275 100644
--- a/packages/locale/locales/hi/erp.po
+++ b/packages/locale/locales/hi/erp.po
@@ -194,6 +194,10 @@ msgstr "{name} हटाया गया"
msgid "{noDemandItemCount} parts skipped — nothing to make"
msgstr "{noDemandItemCount} भाग छोड़ दिए गए — कुछ नहीं बनाना है"
+#. placeholder {0}: (routeData?.purchaseOrder?.revisionId ?? 0) + 1
+msgid "{orderLabel} will be reopened for editing as revision {0}. The document already sent to the supplier is unchanged until you finalize and resend the order."
+msgstr "{orderLabel} को संपादन के लिए संशोधन {0} के रूप में फिर से खोला जाएगा। आपूर्तिकर्ता को भेजा गया दस्तावेज़ जब तक आप इसे अंतिम रूप देते हैं और आदेश को फिर से भेजते हैं तब तक अपरिवर्तित रहता है।"
+
msgid "{remaining, plural, one {# phase left} other {# phases left}}"
msgstr "{remaining, plural, one {# चरण बचा} other {# चरण बचे}}"
@@ -1695,7 +1699,7 @@ msgstr "संग्रहीत"
msgid "Archived Logs"
msgstr "संग्रहीत लॉग"
-#. placeholder {0}: quote.quoteId
+#. placeholder {0}: getQuoteDisplayId(quote)
#. placeholder {1}: formatter.format(total)
msgid "Are you sure you want to accept quote {0} for {1}?"
msgstr "क्या आप सुनिश्चित हैं कि आप उद्धरण {0} को {1} के लिए स्वीकार करना चाहते हैं?"
@@ -1714,9 +1718,8 @@ msgstr "क्या आप सुनिश्चित हैं कि आप
msgid "Are you sure you want to cancel {0}? This will also cancel all related supplier quotes."
msgstr "क्या आप सुनिश्चित हैं कि आप {0} को रद्द करना चाहते हैं? यह सभी संबंधित आपूर्तिकर्ता उद्धरणों को भी रद्द कर देगा।"
-#. placeholder {0}: routeData?.purchaseOrder?.purchaseOrderId ?? "this purchase order"
-msgid "Are you sure you want to cancel {0}? This will close the order."
-msgstr "क्या आप वाकई {0} रद्द करना चाहते हैं? इससे ऑर्डर बंद हो जाएगा।"
+msgid "Are you sure you want to cancel {orderLabel}? This will close the order."
+msgstr "क्या आप सुनिश्चित हैं कि आप {orderLabel} को रद्द करना चाहते हैं? यह आदेश को बंद कर देगा।"
msgid "Are you sure you want to cancel this job? It will no longer be available on the shop floor."
msgstr "क्या आप सुनिश्चित हैं कि आप इस कार्य को रद्द करना चाहते हैं? यह अब शॉप फ्लोर पर उपलब्ध नहीं होगा।"
@@ -1772,15 +1775,18 @@ msgstr "क्या आप सुनिश्चित हैं कि आप
msgid "Are you sure you want to delete {0}?"
msgstr "क्या आप {0} को हटाना सुनिश्चित हैं?"
+#. placeholder {0}: getQuoteDisplayId( routeData?.quote )
+#. placeholder {0}: getQuoteDisplayId( selectedQuotation )
#. placeholder {0}: initialValues.memoId
-#. placeholder {0}: initialValues.paymentId
-#. placeholder {0}: pickingList.pickingListId
msgid "Are you sure you want to delete {0}? This cannot be undone."
msgstr "क्या आप सुनिश्चित हैं कि आप {0} को हटाना चाहते हैं? यह पूर्ववत नहीं किया जा सकता।"
msgid "Are you sure you want to delete {name}? This cannot be undone."
msgstr "क्या आप सुनिश्चित हैं कि आप {name} को हटाना चाहते हैं? यह पूर्ववत नहीं किया जा सकता।"
+msgid "Are you sure you want to delete {orderLabel}? This cannot be undone."
+msgstr "क्या आप सुनिश्चित हैं कि आप {orderLabel} को हटाना चाहते हैं? यह पूर्ववत नहीं किया जा सकता।"
+
#. placeholder {0}: activeView.name
#. placeholder {0}: viewPendingDelete.name
msgid "Are you sure you want to delete the \"{0}\" view? This cannot be undone."
@@ -2921,7 +2927,7 @@ msgid "Change Notices"
msgstr "परिवर्तन सूचनाएं"
msgid "Change notices could not be loaded, so new versions and revisions are blocked. Reload to try again."
-msgstr ""
+msgstr "परिवर्तन सूचनाएँ लोड नहीं की जा सकीं, इसलिए नए संस्करण और संशोधन अवरुद्ध हैं। फिर से प्रयास करने के लिए पुनः लोड करें।"
msgid "Change order"
msgstr "परिवर्तन आदेश"
@@ -3899,6 +3905,9 @@ msgstr "कनबन बनाएं"
msgid "Create new rule"
msgstr "नया नियम बनाएं"
+msgid "Create PO Revision"
+msgstr "PO संशोधन बनाएं"
+
msgid "Create Production Event"
msgstr "उत्पादन घटना बनाएं"
@@ -15469,6 +15478,9 @@ msgstr "यह path केवल यह तय करता है कि आग
msgid "This period has no journal entries posted to it and can be permanently deleted. This cannot be undone."
msgstr "इस अवधि में कोई जर्नल प्रविष्टि पोस्ट नहीं की गई है और इसे स्थायी रूप से हटाया जा सकता है। इसे पूर्ववत नहीं किया जा सकता।"
+msgid "this purchase order"
+msgstr "यह क्रय आदेश"
+
msgid "This Quarter"
msgstr "इस त्रैमासिक"
diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.po
index c0a80bb316..594f2aa7c4 100644
--- a/packages/locale/locales/it/erp.po
+++ b/packages/locale/locales/it/erp.po
@@ -194,6 +194,10 @@ msgstr "{name} eliminato"
msgid "{noDemandItemCount} parts skipped — nothing to make"
msgstr "{noDemandItemCount} parti saltate — niente da produrre"
+#. placeholder {0}: (routeData?.purchaseOrder?.revisionId ?? 0) + 1
+msgid "{orderLabel} will be reopened for editing as revision {0}. The document already sent to the supplier is unchanged until you finalize and resend the order."
+msgstr "{orderLabel} verrà riaperto per la modifica come revisione {0}. Il documento già inviato al fornitore rimane invariato fino a quando non si finalizza e si rinvia l'ordine."
+
msgid "{remaining, plural, one {# phase left} other {# phases left}}"
msgstr "{remaining, plural, one {# fase rimanente} other {# fasi rimanenti}}"
@@ -1695,7 +1699,7 @@ msgstr "Archiviato"
msgid "Archived Logs"
msgstr "Log archiviati"
-#. placeholder {0}: quote.quoteId
+#. placeholder {0}: getQuoteDisplayId(quote)
#. placeholder {1}: formatter.format(total)
msgid "Are you sure you want to accept quote {0} for {1}?"
msgstr "Sei sicuro di voler accettare l'offerta {0} per {1}?"
@@ -1714,9 +1718,8 @@ msgstr "Sei sicuro di voler cancellare {0}? Sarà chiuso e in sola lettura fino
msgid "Are you sure you want to cancel {0}? This will also cancel all related supplier quotes."
msgstr "Sei sicuro di voler annullare {0}? Questo annullerà anche tutte le quotazioni dei fornitori correlate."
-#. placeholder {0}: routeData?.purchaseOrder?.purchaseOrderId ?? "this purchase order"
-msgid "Are you sure you want to cancel {0}? This will close the order."
-msgstr "Sei sicuro di voler annullare {0}? Questo chiuderà l'ordine."
+msgid "Are you sure you want to cancel {orderLabel}? This will close the order."
+msgstr "Sei sicuro di voler annullare {orderLabel}? Questo chiuderà l'ordine."
msgid "Are you sure you want to cancel this job? It will no longer be available on the shop floor."
msgstr "Sei sicuro di voler annullare questo lavoro? Non sarà più disponibile in officina."
@@ -1772,15 +1775,18 @@ msgstr "Sei sicuro di voler eliminare {0} da questa operazione? Questa azione no
msgid "Are you sure you want to delete {0}?"
msgstr "Sei sicuro di voler eliminare {0}?"
+#. placeholder {0}: getQuoteDisplayId( routeData?.quote )
+#. placeholder {0}: getQuoteDisplayId( selectedQuotation )
#. placeholder {0}: initialValues.memoId
-#. placeholder {0}: initialValues.paymentId
-#. placeholder {0}: pickingList.pickingListId
msgid "Are you sure you want to delete {0}? This cannot be undone."
msgstr "Sei sicuro di voler eliminare {0}? Questa azione non può essere annullata."
msgid "Are you sure you want to delete {name}? This cannot be undone."
msgstr "Sei sicuro di voler eliminare {name}? Questa azione non può essere annullata."
+msgid "Are you sure you want to delete {orderLabel}? This cannot be undone."
+msgstr "Sei sicuro di voler eliminare {orderLabel}? Questa azione non può essere annullata."
+
#. placeholder {0}: activeView.name
#. placeholder {0}: viewPendingDelete.name
msgid "Are you sure you want to delete the \"{0}\" view? This cannot be undone."
@@ -2921,7 +2927,7 @@ msgid "Change Notices"
msgstr "Avvisi di modifica"
msgid "Change notices could not be loaded, so new versions and revisions are blocked. Reload to try again."
-msgstr ""
+msgstr "Non è stato possibile caricare gli avvisi di modifica, quindi le nuove versioni e revisioni sono bloccate. Ricarica per provare di nuovo."
msgid "Change order"
msgstr "Ordine di modifica"
@@ -3899,6 +3905,9 @@ msgstr "Crea Kanban"
msgid "Create new rule"
msgstr "Crea nuova regola"
+msgid "Create PO Revision"
+msgstr "Crea Revisione PO"
+
msgid "Create Production Event"
msgstr "Crea Evento Produzione"
@@ -10658,7 +10667,7 @@ msgid "Packing Slip"
msgstr "Documento di trasporto"
msgid "Pad amounts to their currency's decimal places, so 300 appears as 300.00 and columns of figures stay aligned. Turn this off to show only the digits that carry value. Printed documents and stored amounts are unaffected either way."
-msgstr "Riempi i valori in base alle cifre decimali della valuta, in modo che 300 appaia come 300.00 e le colonne di cifre rimangono allineate. Disattivalo per mostrare solo le cifre che hanno valore. I documenti stampati e gli importi memorizzati non sono interessati in nessun modo."
+msgstr "Riempi i valori in base alle cifre decimali della valuta, in modo che 300 appaia come 300,00 e le colonne di cifre rimangono allineate. Disattivalo per mostrare solo le cifre che hanno valore. I documenti stampati e gli importi memorizzati non sono interessati in nessun modo."
msgid "Page"
msgstr "Pagina"
@@ -15469,6 +15478,9 @@ msgstr "Questo percorso decide solo cosa viene eseguito dopo"
msgid "This period has no journal entries posted to it and can be permanently deleted. This cannot be undone."
msgstr "Questo periodo non ha movimenti di diario registrati e può essere eliminato permanentemente. Questo non può essere annullato."
+msgid "this purchase order"
+msgstr "questo ordine di acquisto"
+
msgid "This Quarter"
msgstr "Questo Trimestre"
diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.po
index 672a5ea85b..65c363eee2 100644
--- a/packages/locale/locales/ja/erp.po
+++ b/packages/locale/locales/ja/erp.po
@@ -194,6 +194,10 @@ msgstr "{name}が削除されました"
msgid "{noDemandItemCount} parts skipped — nothing to make"
msgstr "{noDemandItemCount}件のパーツをスキップしました — 製造する必要がありません"
+#. placeholder {0}: (routeData?.purchaseOrder?.revisionId ?? 0) + 1
+msgid "{orderLabel} will be reopened for editing as revision {0}. The document already sent to the supplier is unchanged until you finalize and resend the order."
+msgstr "{orderLabel}はリビジョン{0}として編集のために再度開かれます。既にサプライヤーに送信したドキュメントは、確定して注文を再度送信するまで変更されません。"
+
msgid "{remaining, plural, one {# phase left} other {# phases left}}"
msgstr "{remaining, plural, one {# フェーズ残り} other {# フェーズ残り}}"
@@ -1695,7 +1699,7 @@ msgstr "アーカイブ済み"
msgid "Archived Logs"
msgstr "アーカイブされたログ"
-#. placeholder {0}: quote.quoteId
+#. placeholder {0}: getQuoteDisplayId(quote)
#. placeholder {1}: formatter.format(total)
msgid "Are you sure you want to accept quote {0} for {1}?"
msgstr "本当に見積書 {0} を {1} で受け入れてもよろしいですか?"
@@ -1714,9 +1718,8 @@ msgstr "{0}をキャンセルしてもよろしいですか?閉じられて、
msgid "Are you sure you want to cancel {0}? This will also cancel all related supplier quotes."
msgstr "{0}をキャンセルしてもよろしいですか?これにより、関連するすべてのサプライヤー見積もりもキャンセルされます。"
-#. placeholder {0}: routeData?.purchaseOrder?.purchaseOrderId ?? "this purchase order"
-msgid "Are you sure you want to cancel {0}? This will close the order."
-msgstr "{0}をキャンセルしてもよろしいですか?注文が閉じられます。"
+msgid "Are you sure you want to cancel {orderLabel}? This will close the order."
+msgstr "{orderLabel}をキャンセルしてもよろしいですか?これにより注文が閉じられます。"
msgid "Are you sure you want to cancel this job? It will no longer be available on the shop floor."
msgstr "このジョブをキャンセルしてもよろしいですか?ショップフロアで利用できなくなります。"
@@ -1772,15 +1775,18 @@ msgstr "{0}をこの操作から削除してもよろしいですか?これは
msgid "Are you sure you want to delete {0}?"
msgstr "{0}を削除してもよろしいですか?"
+#. placeholder {0}: getQuoteDisplayId( routeData?.quote )
+#. placeholder {0}: getQuoteDisplayId( selectedQuotation )
#. placeholder {0}: initialValues.memoId
-#. placeholder {0}: initialValues.paymentId
-#. placeholder {0}: pickingList.pickingListId
msgid "Are you sure you want to delete {0}? This cannot be undone."
msgstr "本当に{0}を削除してもよろしいですか?この操作は取り消せません。"
msgid "Are you sure you want to delete {name}? This cannot be undone."
msgstr "本当に{name}を削除してもよろしいですか?この操作は取り消せません。"
+msgid "Are you sure you want to delete {orderLabel}? This cannot be undone."
+msgstr "本当に{orderLabel}を削除してもよろしいですか?この操作は取り消せません。"
+
#. placeholder {0}: activeView.name
#. placeholder {0}: viewPendingDelete.name
msgid "Are you sure you want to delete the \"{0}\" view? This cannot be undone."
@@ -2921,7 +2927,7 @@ msgid "Change Notices"
msgstr "変更通知"
msgid "Change notices could not be loaded, so new versions and revisions are blocked. Reload to try again."
-msgstr ""
+msgstr "変更通知を読み込めませんでした。新しいバージョンとリビジョンはブロックされています。再度読み込んでください。"
msgid "Change order"
msgstr "変更注文"
@@ -3899,6 +3905,9 @@ msgstr "カンバンを作成"
msgid "Create new rule"
msgstr "新しいルールを作成"
+msgid "Create PO Revision"
+msgstr "発注書リビジョンを作成"
+
msgid "Create Production Event"
msgstr "生産イベントを作成"
@@ -15469,6 +15478,9 @@ msgstr "このパスは次に何が実行されるかだけを決定します"
msgid "This period has no journal entries posted to it and can be permanently deleted. This cannot be undone."
msgstr "この期間には転記された仕訳がなく、永久に削除できます。この処理は取り消せません。"
+msgid "this purchase order"
+msgstr "この発注書"
+
msgid "This Quarter"
msgstr "今四半期"
diff --git a/packages/locale/locales/ko/erp.po b/packages/locale/locales/ko/erp.po
index f05fc88e69..a009a4302a 100644
--- a/packages/locale/locales/ko/erp.po
+++ b/packages/locale/locales/ko/erp.po
@@ -194,6 +194,10 @@ msgstr "{name} 삭제됨"
msgid "{noDemandItemCount} parts skipped — nothing to make"
msgstr "{noDemandItemCount}개 부품이 건너뜀 — 만들 것이 없음"
+#. placeholder {0}: (routeData?.purchaseOrder?.revisionId ?? 0) + 1
+msgid "{orderLabel} will be reopened for editing as revision {0}. The document already sent to the supplier is unchanged until you finalize and resend the order."
+msgstr "{orderLabel}이(가) 리비전 {0}으로 편집을 위해 다시 열립니다. 공급자에게 이미 보낸 문서는 주문을 확정하고 재전송할 때까지 변경되지 않습니다."
+
msgid "{remaining, plural, one {# phase left} other {# phases left}}"
msgstr "{remaining}단계 남음"
@@ -1695,7 +1699,7 @@ msgstr "보관됨"
msgid "Archived Logs"
msgstr "보관된 로그"
-#. placeholder {0}: quote.quoteId
+#. placeholder {0}: getQuoteDisplayId(quote)
#. placeholder {1}: formatter.format(total)
msgid "Are you sure you want to accept quote {0} for {1}?"
msgstr "{1}에 대한 견적 {0}을(를) 승인하시겠습니까?"
@@ -1714,9 +1718,8 @@ msgstr "{0}을(를) 취소하시겠습니까? 취소되면 다시 열 때까지
msgid "Are you sure you want to cancel {0}? This will also cancel all related supplier quotes."
msgstr "{0}을(를) 취소하시겠습니까? 관련된 모든 공급업체 견적도 함께 취소됩니다."
-#. placeholder {0}: routeData?.purchaseOrder?.purchaseOrderId ?? "this purchase order"
-msgid "Are you sure you want to cancel {0}? This will close the order."
-msgstr "{0}을(를) 취소하시겠습니까? 주문이 종료됩니다."
+msgid "Are you sure you want to cancel {orderLabel}? This will close the order."
+msgstr "{orderLabel}을(를) 취소하시겠습니까? 주문이 종료됩니다."
msgid "Are you sure you want to cancel this job? It will no longer be available on the shop floor."
msgstr "이 작업을 취소하시겠습니까? 더 이상 현장에서 사용할 수 없게 됩니다."
@@ -1772,15 +1775,18 @@ msgstr "이 공정작업에서 {0}을(를) 삭제하시겠습니까? 이 작업
msgid "Are you sure you want to delete {0}?"
msgstr "{0}을(를) 삭제하시겠습니까?"
+#. placeholder {0}: getQuoteDisplayId( routeData?.quote )
+#. placeholder {0}: getQuoteDisplayId( selectedQuotation )
#. placeholder {0}: initialValues.memoId
-#. placeholder {0}: initialValues.paymentId
-#. placeholder {0}: pickingList.pickingListId
msgid "Are you sure you want to delete {0}? This cannot be undone."
msgstr "{0}을(를) 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다."
msgid "Are you sure you want to delete {name}? This cannot be undone."
msgstr "{name}을(를) 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다."
+msgid "Are you sure you want to delete {orderLabel}? This cannot be undone."
+msgstr "{orderLabel}을(를) 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다."
+
#. placeholder {0}: activeView.name
#. placeholder {0}: viewPendingDelete.name
msgid "Are you sure you want to delete the \"{0}\" view? This cannot be undone."
@@ -2921,7 +2927,7 @@ msgid "Change Notices"
msgstr "변경 공지"
msgid "Change notices could not be loaded, so new versions and revisions are blocked. Reload to try again."
-msgstr ""
+msgstr "변경 공지를 로드할 수 없어 새 버전과 개정이 차단되었습니다. 다시 로드하세요."
msgid "Change order"
msgstr "변경 주문"
@@ -3899,6 +3905,9 @@ msgstr "칸반 생성"
msgid "Create new rule"
msgstr "새 규칙 생성"
+msgid "Create PO Revision"
+msgstr "구매주문 리비전 생성"
+
msgid "Create Production Event"
msgstr "생산 이벤트 생성"
@@ -15469,6 +15478,9 @@ msgstr "이 경로는 다음에 실행할 작업만 결정합니다."
msgid "This period has no journal entries posted to it and can be permanently deleted. This cannot be undone."
msgstr "이 기간에는 게시된 분개가 없으며 영구적으로 삭제할 수 있습니다. 이는 되돌릴 수 없습니다."
+msgid "this purchase order"
+msgstr "이 구매주문"
+
msgid "This Quarter"
msgstr "이번 분기"
diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.po
index 84e23e20e4..5953ddfb62 100644
--- a/packages/locale/locales/pl/erp.po
+++ b/packages/locale/locales/pl/erp.po
@@ -194,6 +194,10 @@ msgstr "{name} usunięty"
msgid "{noDemandItemCount} parts skipped — nothing to make"
msgstr "{noDemandItemCount} części pominięto — nic do zrobienia"
+#. placeholder {0}: (routeData?.purchaseOrder?.revisionId ?? 0) + 1
+msgid "{orderLabel} will be reopened for editing as revision {0}. The document already sent to the supplier is unchanged until you finalize and resend the order."
+msgstr "{orderLabel} będzie ponownie otwarte do edycji jako wersja {0}. Dokument już wysłany do dostawcy nie zmieni się, dopóki nie sfinalizujesz i nie wyślesz ponownie zamówienia."
+
msgid "{remaining, plural, one {# phase left} other {# phases left}}"
msgstr "{remaining, plural, one {# faza pozostała} other {# faz pozostało}}"
@@ -1695,7 +1699,7 @@ msgstr "Zarchiwizowane"
msgid "Archived Logs"
msgstr "Zarchiwizowane dzienniki"
-#. placeholder {0}: quote.quoteId
+#. placeholder {0}: getQuoteDisplayId(quote)
#. placeholder {1}: formatter.format(total)
msgid "Are you sure you want to accept quote {0} for {1}?"
msgstr "Czy na pewno chcesz zaakceptować ofertę {0} za {1}?"
@@ -1714,9 +1718,8 @@ msgstr "Czy na pewno chcesz anulować {0}? Będzie zamknięte i tylko do odczytu
msgid "Are you sure you want to cancel {0}? This will also cancel all related supplier quotes."
msgstr "Czy na pewno chcesz anulować {0}? Spowoduje to również anulowanie wszystkich powiązanych ofert dostawców."
-#. placeholder {0}: routeData?.purchaseOrder?.purchaseOrderId ?? "this purchase order"
-msgid "Are you sure you want to cancel {0}? This will close the order."
-msgstr "Czy na pewno chcesz anulować {0}? Spowoduje to zamknięcie zamówienia."
+msgid "Are you sure you want to cancel {orderLabel}? This will close the order."
+msgstr "Czy na pewno chcesz anulować {orderLabel}? Spowoduje to zamknięcie zamówienia."
msgid "Are you sure you want to cancel this job? It will no longer be available on the shop floor."
msgstr "Czy na pewno chcesz anulować to zadanie? Nie będzie już dostępne na hali produkcyjnej."
@@ -1772,15 +1775,18 @@ msgstr "Czy na pewno chcesz usunąć {0} z tej operacji? Tej czynności nie moż
msgid "Are you sure you want to delete {0}?"
msgstr "Czy na pewno chcesz usunąć {0}?"
+#. placeholder {0}: getQuoteDisplayId( routeData?.quote )
+#. placeholder {0}: getQuoteDisplayId( selectedQuotation )
#. placeholder {0}: initialValues.memoId
-#. placeholder {0}: initialValues.paymentId
-#. placeholder {0}: pickingList.pickingListId
msgid "Are you sure you want to delete {0}? This cannot be undone."
msgstr "Czy na pewno chcesz usunąć {0}? Tej operacji nie można cofnąć."
msgid "Are you sure you want to delete {name}? This cannot be undone."
msgstr "Czy na pewno chcesz usunąć {name}? Tej operacji nie można cofnąć."
+msgid "Are you sure you want to delete {orderLabel}? This cannot be undone."
+msgstr "Czy na pewno chcesz usunąć {orderLabel}? Tej operacji nie można cofnąć."
+
#. placeholder {0}: activeView.name
#. placeholder {0}: viewPendingDelete.name
msgid "Are you sure you want to delete the \"{0}\" view? This cannot be undone."
@@ -2921,7 +2927,7 @@ msgid "Change Notices"
msgstr "Zgłoszenia Zmian"
msgid "Change notices could not be loaded, so new versions and revisions are blocked. Reload to try again."
-msgstr ""
+msgstr "Nie można załadować zgłoszeń zmian, dlatego nowe wersje i rewizje są zablokowane. Odśwież, aby spróbować ponownie."
msgid "Change order"
msgstr "Zmiana zamówienia"
@@ -3899,6 +3905,9 @@ msgstr "Utwórz Kanban"
msgid "Create new rule"
msgstr "Utwórz nową regułę"
+msgid "Create PO Revision"
+msgstr "Utwórz rewizję zamówienia zakupu"
+
msgid "Create Production Event"
msgstr "Utwórz Zdarzenie Produkcji"
@@ -15469,6 +15478,9 @@ msgstr "Ta ścieżka decyduje tylko o tym, co uruchomi się dalej"
msgid "This period has no journal entries posted to it and can be permanently deleted. This cannot be undone."
msgstr "Ten okres nie ma żadnych wpisów w dzienniku i może być trwale usunięty. Tej operacji nie można cofnąć."
+msgid "this purchase order"
+msgstr "to zamówienie zakupu"
+
msgid "This Quarter"
msgstr "Ten Kwartał"
diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.po
index 80faf1cebf..e23cc0e02e 100644
--- a/packages/locale/locales/pt/erp.po
+++ b/packages/locale/locales/pt/erp.po
@@ -194,6 +194,10 @@ msgstr "{name} eliminado"
msgid "{noDemandItemCount} parts skipped — nothing to make"
msgstr "{noDemandItemCount} peças ignoradas — nada para fabricar"
+#. placeholder {0}: (routeData?.purchaseOrder?.revisionId ?? 0) + 1
+msgid "{orderLabel} will be reopened for editing as revision {0}. The document already sent to the supplier is unchanged until you finalize and resend the order."
+msgstr "{orderLabel} será reaberto para edição como revisão {0}. O documento já enviado ao fornecedor permanece inalterado até que você finalize e reenvie o pedido."
+
msgid "{remaining, plural, one {# phase left} other {# phases left}}"
msgstr "{remaining, plural, one {# fase restante} other {# fases restantes}}"
@@ -1695,7 +1699,7 @@ msgstr "Arquivado"
msgid "Archived Logs"
msgstr "Logs Arquivados"
-#. placeholder {0}: quote.quoteId
+#. placeholder {0}: getQuoteDisplayId(quote)
#. placeholder {1}: formatter.format(total)
msgid "Are you sure you want to accept quote {0} for {1}?"
msgstr "Tem a certeza de que deseja aceitar a cotação {0} por {1}?"
@@ -1714,9 +1718,8 @@ msgstr "Tem certeza de que deseja cancelar {0}? Será fechado e somente leitura
msgid "Are you sure you want to cancel {0}? This will also cancel all related supplier quotes."
msgstr "Tem a certeza de que deseja cancelar {0}? Isto também cancelará todas as cotações de fornecedores relacionadas."
-#. placeholder {0}: routeData?.purchaseOrder?.purchaseOrderId ?? "this purchase order"
-msgid "Are you sure you want to cancel {0}? This will close the order."
-msgstr "Tem certeza que deseja cancelar {0}? Isso fechará o pedido."
+msgid "Are you sure you want to cancel {orderLabel}? This will close the order."
+msgstr "Tem certeza de que deseja cancelar {orderLabel}? Isso fechará o pedido."
msgid "Are you sure you want to cancel this job? It will no longer be available on the shop floor."
msgstr "Tem a certeza de que deseja cancelar este trabalho? Deixará de estar disponível no chão de fábrica."
@@ -1772,15 +1775,18 @@ msgstr "Tem a certeza de que deseja eliminar {0} desta operação? Isto não pod
msgid "Are you sure you want to delete {0}?"
msgstr "Tem a certeza de que deseja eliminar {0}?"
+#. placeholder {0}: getQuoteDisplayId( routeData?.quote )
+#. placeholder {0}: getQuoteDisplayId( selectedQuotation )
#. placeholder {0}: initialValues.memoId
-#. placeholder {0}: initialValues.paymentId
-#. placeholder {0}: pickingList.pickingListId
msgid "Are you sure you want to delete {0}? This cannot be undone."
msgstr "Tem a certeza de que deseja eliminar {0}? Esta ação não pode ser desfeita."
msgid "Are you sure you want to delete {name}? This cannot be undone."
msgstr "Tem a certeza de que deseja eliminar {name}? Esta ação não pode ser desfeita."
+msgid "Are you sure you want to delete {orderLabel}? This cannot be undone."
+msgstr "Tem certeza de que deseja excluir {orderLabel}? Isso não pode ser desfeito."
+
#. placeholder {0}: activeView.name
#. placeholder {0}: viewPendingDelete.name
msgid "Are you sure you want to delete the \"{0}\" view? This cannot be undone."
@@ -2921,7 +2927,7 @@ msgid "Change Notices"
msgstr "Avisos de Mudança"
msgid "Change notices could not be loaded, so new versions and revisions are blocked. Reload to try again."
-msgstr ""
+msgstr "Os avisos de mudança não puderam ser carregados, portanto novas versões e revisões estão bloqueadas. Recarregue para tentar novamente."
msgid "Change order"
msgstr "Ordem de mudança"
@@ -3899,6 +3905,9 @@ msgstr "Criar Kanban"
msgid "Create new rule"
msgstr "Criar nova regra"
+msgid "Create PO Revision"
+msgstr "Criar Revisão de PO"
+
msgid "Create Production Event"
msgstr "Criar Evento de Produção"
@@ -10658,7 +10667,7 @@ msgid "Packing Slip"
msgstr "Guia de Remessa"
msgid "Pad amounts to their currency's decimal places, so 300 appears as 300.00 and columns of figures stay aligned. Turn this off to show only the digits that carry value. Printed documents and stored amounts are unaffected either way."
-msgstr "Preencha os valores com os lugares decimais da moeda, para que 300 apareça como 300.00 e as colunas de números permaneçam alinhadas. Desative isso para mostrar apenas os dígitos significativos. Documentos impressos e valores armazenados não são afetados."
+msgstr "Preencha os valores com os lugares decimais da moeda, para que 300 apareça como 300,00 e as colunas de números permaneçam alinhadas. Desative isso para mostrar apenas os dígitos significativos. Documentos impressos e valores armazenados não são afetados."
msgid "Page"
msgstr "Página"
@@ -15469,6 +15478,9 @@ msgstr "Este caminho apenas decide o que é executado a seguir"
msgid "This period has no journal entries posted to it and can be permanently deleted. This cannot be undone."
msgstr "Este período não tem lançamentos de diário nele e pode ser deletado permanentemente. Isso não pode ser desfeito."
+msgid "this purchase order"
+msgstr "esta ordem de compra"
+
msgid "This Quarter"
msgstr "Este Trimestre"
diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.po
index 7978e7fb7d..f1f7700c70 100644
--- a/packages/locale/locales/ru/erp.po
+++ b/packages/locale/locales/ru/erp.po
@@ -194,6 +194,10 @@ msgstr "{name} удален"
msgid "{noDemandItemCount} parts skipped — nothing to make"
msgstr "{noDemandItemCount} деталей пропущено — нечего делать"
+#. placeholder {0}: (routeData?.purchaseOrder?.revisionId ?? 0) + 1
+msgid "{orderLabel} will be reopened for editing as revision {0}. The document already sent to the supplier is unchanged until you finalize and resend the order."
+msgstr "{orderLabel} будет переоткрыта для редактирования как редакция {0}. Документ, уже отправленный поставщику, остается без изменений, пока вы не завершите и не отправите заказ заново."
+
msgid "{remaining, plural, one {# phase left} other {# phases left}}"
msgstr "{remaining, plural, one {# этап остался} other {# этапов осталось}}"
@@ -1695,7 +1699,7 @@ msgstr "Архивировано"
msgid "Archived Logs"
msgstr "Архивированные журналы"
-#. placeholder {0}: quote.quoteId
+#. placeholder {0}: getQuoteDisplayId(quote)
#. placeholder {1}: formatter.format(total)
msgid "Are you sure you want to accept quote {0} for {1}?"
msgstr "Вы уверены, что хотите принять предложение {0} на сумму {1}?"
@@ -1714,9 +1718,8 @@ msgstr "Вы уверены, что хотите отменить {0}? Он бу
msgid "Are you sure you want to cancel {0}? This will also cancel all related supplier quotes."
msgstr "Вы уверены, что хотите отменить {0}? Это также отменит все связанные предложения поставщиков."
-#. placeholder {0}: routeData?.purchaseOrder?.purchaseOrderId ?? "this purchase order"
-msgid "Are you sure you want to cancel {0}? This will close the order."
-msgstr "Вы уверены, что хотите отменить {0}? Это закроет заказ."
+msgid "Are you sure you want to cancel {orderLabel}? This will close the order."
+msgstr "Вы уверены, что хотите отменить {orderLabel}? Это закроет заказ."
msgid "Are you sure you want to cancel this job? It will no longer be available on the shop floor."
msgstr "Вы уверены, что хотите отменить эту работу? Она больше не будет доступна на производственном участке."
@@ -1772,15 +1775,18 @@ msgstr "Вы уверены, что хотите удалить {0} из это
msgid "Are you sure you want to delete {0}?"
msgstr "Вы уверены, что хотите удалить {0}?"
+#. placeholder {0}: getQuoteDisplayId( routeData?.quote )
+#. placeholder {0}: getQuoteDisplayId( selectedQuotation )
#. placeholder {0}: initialValues.memoId
-#. placeholder {0}: initialValues.paymentId
-#. placeholder {0}: pickingList.pickingListId
msgid "Are you sure you want to delete {0}? This cannot be undone."
msgstr "Вы уверены, что хотите удалить {0}? Это действие невозможно отменить."
msgid "Are you sure you want to delete {name}? This cannot be undone."
msgstr "Вы уверены, что хотите удалить {name}? Это действие невозможно отменить."
+msgid "Are you sure you want to delete {orderLabel}? This cannot be undone."
+msgstr "Вы уверены, что хотите удалить {orderLabel}? Это действие невозможно отменить."
+
#. placeholder {0}: activeView.name
#. placeholder {0}: viewPendingDelete.name
msgid "Are you sure you want to delete the \"{0}\" view? This cannot be undone."
@@ -2921,7 +2927,7 @@ msgid "Change Notices"
msgstr "Уведомления об изменении"
msgid "Change notices could not be loaded, so new versions and revisions are blocked. Reload to try again."
-msgstr ""
+msgstr "Уведомления об изменении не удалось загрузить, поэтому новые версии и редакции заблокированы. Перезагрузите страницу, чтобы попробовать еще раз."
msgid "Change order"
msgstr "Изменение заказа"
@@ -3899,6 +3905,9 @@ msgstr "Создать Kanban"
msgid "Create new rule"
msgstr "Создать новое правило"
+msgid "Create PO Revision"
+msgstr "Создать редакцию заказа на покупку"
+
msgid "Create Production Event"
msgstr "Создать производственное событие"
@@ -15469,6 +15478,9 @@ msgstr "Этот путь решает только, что будет запу
msgid "This period has no journal entries posted to it and can be permanently deleted. This cannot be undone."
msgstr "В этот период не размещены записи журнала, и он может быть окончательно удален. Это действие нельзя отменить."
+msgid "this purchase order"
+msgstr "этот заказ на покупку"
+
msgid "This Quarter"
msgstr "Этот квартал"
diff --git a/packages/locale/locales/tr/erp.po b/packages/locale/locales/tr/erp.po
index b61a44b6f5..85ab4d51c4 100644
--- a/packages/locale/locales/tr/erp.po
+++ b/packages/locale/locales/tr/erp.po
@@ -194,6 +194,10 @@ msgstr "{name} silindi"
msgid "{noDemandItemCount} parts skipped — nothing to make"
msgstr "{noDemandItemCount} parça atlandı — yapılacak bir şey yok"
+#. placeholder {0}: (routeData?.purchaseOrder?.revisionId ?? 0) + 1
+msgid "{orderLabel} will be reopened for editing as revision {0}. The document already sent to the supplier is unchanged until you finalize and resend the order."
+msgstr "{orderLabel} revizyon {0} olarak düzenlenmek üzere yeniden açılacaktır. Tedarikçiye gönderilen belge, siparişi sonlandırıp yeniden gönderene kadar değişmez."
+
msgid "{remaining, plural, one {# phase left} other {# phases left}}"
msgstr "{remaining, plural, one {# aşama kaldı} other {# aşama kaldı}}"
@@ -1695,7 +1699,7 @@ msgstr "Arşivlenmiş"
msgid "Archived Logs"
msgstr "Arşivlenmiş Kayıtlar"
-#. placeholder {0}: quote.quoteId
+#. placeholder {0}: getQuoteDisplayId(quote)
#. placeholder {1}: formatter.format(total)
msgid "Are you sure you want to accept quote {0} for {1}?"
msgstr "Teklif {0}'ı {1} için kabul etmek istediğinizden emin misiniz?"
@@ -1714,9 +1718,8 @@ msgstr "{0} öğesini iptal etmek istediğinizden emin misiniz? Yeniden açana k
msgid "Are you sure you want to cancel {0}? This will also cancel all related supplier quotes."
msgstr "{0}'yi iptal etmek istediğinizden emin misiniz? Bu aynı zamanda tüm ilgili tedarikçi tekliflerini de iptal edecektir."
-#. placeholder {0}: routeData?.purchaseOrder?.purchaseOrderId ?? "this purchase order"
-msgid "Are you sure you want to cancel {0}? This will close the order."
-msgstr "{0} siparişini iptal etmek istediğinizden emin misiniz? Bu siparişi kapatacaktır."
+msgid "Are you sure you want to cancel {orderLabel}? This will close the order."
+msgstr "{orderLabel}'yi iptal etmek istediğinizden emin misiniz? Bu siparişi kapatacaktır."
msgid "Are you sure you want to cancel this job? It will no longer be available on the shop floor."
msgstr "Bu işi iptal etmek istediğinizden emin misiniz? Artık atölyede kullanılamayacak."
@@ -1772,15 +1775,18 @@ msgstr "Bu işlemden {0}'ı silmek istediğinizden emin misiniz? Bu geri alınam
msgid "Are you sure you want to delete {0}?"
msgstr "{0} öğesini silmek istediğinizden emin misiniz?"
+#. placeholder {0}: getQuoteDisplayId( routeData?.quote )
+#. placeholder {0}: getQuoteDisplayId( selectedQuotation )
#. placeholder {0}: initialValues.memoId
-#. placeholder {0}: initialValues.paymentId
-#. placeholder {0}: pickingList.pickingListId
msgid "Are you sure you want to delete {0}? This cannot be undone."
msgstr "Emin misiniz ki {0}'ı silmek istiyorsunuz? Bu geri alınamaz."
msgid "Are you sure you want to delete {name}? This cannot be undone."
msgstr "{name} adlı yedeği silmek istediğinizden emin misiniz? Bu işlem geri alınamaz."
+msgid "Are you sure you want to delete {orderLabel}? This cannot be undone."
+msgstr "{orderLabel}'yi silmek istediğinizden emin misiniz? Bu geri alınamaz."
+
#. placeholder {0}: activeView.name
#. placeholder {0}: viewPendingDelete.name
msgid "Are you sure you want to delete the \"{0}\" view? This cannot be undone."
@@ -2921,7 +2927,7 @@ msgid "Change Notices"
msgstr "Değişiklik Bildirimleri"
msgid "Change notices could not be loaded, so new versions and revisions are blocked. Reload to try again."
-msgstr ""
+msgstr "Değişiklik Bildirimleri yüklenemedi, bu nedenle yeni sürümler ve revizyonlar engellendi. Tekrar denemek için sayfayı yeniden yükleyin."
msgid "Change order"
msgstr "Değişim emri"
@@ -3899,6 +3905,9 @@ msgstr "Kanban Oluştur"
msgid "Create new rule"
msgstr "Yeni kural oluştur"
+msgid "Create PO Revision"
+msgstr "PO Revizyonu Oluştur"
+
msgid "Create Production Event"
msgstr "Üretim Etkinliği Oluştur"
@@ -10658,7 +10667,7 @@ msgid "Packing Slip"
msgstr "Paketleme Fişi"
msgid "Pad amounts to their currency's decimal places, so 300 appears as 300.00 and columns of figures stay aligned. Turn this off to show only the digits that carry value. Printed documents and stored amounts are unaffected either way."
-msgstr "Miktarları para biriminin ondalık basamaklarına göre doldur, böylece 300, 300.00 olarak görünür ve sayı sütunları hizalı kalır. Yalnızca değer taşıyan rakamları göstermek için bunu kapatın. Yazdırılan belgeler ve depolanan miktarlar her iki durumda da etkilenmez."
+msgstr "Miktarları para biriminin ondalık basamaklarına göre doldur, böylece 300, 300,00 olarak görünür ve sayı sütunları hizalı kalır. Yalnızca değer taşıyan rakamları göstermek için bunu kapatın. Yazdırılan belgeler ve depolanan miktarlar her iki durumda da etkilenmez."
msgid "Page"
msgstr "Sayfa"
@@ -15469,6 +15478,9 @@ msgstr "Bu yol yalnızca sonra ne çalışacağını belirler"
msgid "This period has no journal entries posted to it and can be permanently deleted. This cannot be undone."
msgstr "Bu döneme nakledilen günlük girişi yoktur ve kalıcı olarak silinebilir. Bu geri alınamaz."
+msgid "this purchase order"
+msgstr "bu satın alma siparişi"
+
msgid "This Quarter"
msgstr "Bu Çeyrek"
diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.po
index 853b30fd4b..6b2c1f76f4 100644
--- a/packages/locale/locales/zh/erp.po
+++ b/packages/locale/locales/zh/erp.po
@@ -194,6 +194,10 @@ msgstr "{name} 已删除"
msgid "{noDemandItemCount} parts skipped — nothing to make"
msgstr "{noDemandItemCount} 个零件已跳过 — 没有需要生产的"
+#. placeholder {0}: (routeData?.purchaseOrder?.revisionId ?? 0) + 1
+msgid "{orderLabel} will be reopened for editing as revision {0}. The document already sent to the supplier is unchanged until you finalize and resend the order."
+msgstr "{orderLabel} 将被重新打开以作为修订版本 {0} 进行编辑。已发送给供应商的文件在您完成并重新发送订单前保持不变。"
+
msgid "{remaining, plural, one {# phase left} other {# phases left}}"
msgstr "{remaining, plural, one {# 个阶段剩余} other {# 个阶段剩余}}"
@@ -1695,7 +1699,7 @@ msgstr "已归档"
msgid "Archived Logs"
msgstr "已归档日志"
-#. placeholder {0}: quote.quoteId
+#. placeholder {0}: getQuoteDisplayId(quote)
#. placeholder {1}: formatter.format(total)
msgid "Are you sure you want to accept quote {0} for {1}?"
msgstr "你确定要接受报价 {0} 的 {1} 吗?"
@@ -1714,9 +1718,8 @@ msgstr "您确定要取消 {0} 吗?在您重新打开之前,它将被关闭并
msgid "Are you sure you want to cancel {0}? This will also cancel all related supplier quotes."
msgstr "您确定要取消 {0} 吗?这也将取消所有相关的供应商报价。"
-#. placeholder {0}: routeData?.purchaseOrder?.purchaseOrderId ?? "this purchase order"
-msgid "Are you sure you want to cancel {0}? This will close the order."
-msgstr "确定要取消{0}吗?这将关闭订单。"
+msgid "Are you sure you want to cancel {orderLabel}? This will close the order."
+msgstr "您确定要取消 {orderLabel} 吗?这将关闭订单。"
msgid "Are you sure you want to cancel this job? It will no longer be available on the shop floor."
msgstr "你确定要取消此工作吗?它将不再在车间可用。"
@@ -1772,15 +1775,18 @@ msgstr "你确定要从此操作中删除 {0} 吗?此操作无法撤销。"
msgid "Are you sure you want to delete {0}?"
msgstr "你确定要删除 {0} 吗?"
+#. placeholder {0}: getQuoteDisplayId( routeData?.quote )
+#. placeholder {0}: getQuoteDisplayId( selectedQuotation )
#. placeholder {0}: initialValues.memoId
-#. placeholder {0}: initialValues.paymentId
-#. placeholder {0}: pickingList.pickingListId
msgid "Are you sure you want to delete {0}? This cannot be undone."
msgstr "您确定要删除 {0} 吗?此操作无法撤销。"
msgid "Are you sure you want to delete {name}? This cannot be undone."
msgstr "您确定要删除 {name} 吗?此操作无法撤销。"
+msgid "Are you sure you want to delete {orderLabel}? This cannot be undone."
+msgstr "您确定要删除 {orderLabel} 吗?此操作无法撤销。"
+
#. placeholder {0}: activeView.name
#. placeholder {0}: viewPendingDelete.name
msgid "Are you sure you want to delete the \"{0}\" view? This cannot be undone."
@@ -2921,7 +2927,7 @@ msgid "Change Notices"
msgstr "更改单"
msgid "Change notices could not be loaded, so new versions and revisions are blocked. Reload to try again."
-msgstr ""
+msgstr "无法加载更改单,因此新版本和修订版本已被阻止。请重新加载以重试。"
msgid "Change order"
msgstr "变更单"
@@ -3899,6 +3905,9 @@ msgstr "创建看板"
msgid "Create new rule"
msgstr "创建新规则"
+msgid "Create PO Revision"
+msgstr "创建采购订单修订版本"
+
msgid "Create Production Event"
msgstr "创建生产事件"
@@ -15469,6 +15478,9 @@ msgstr "此路径仅决定接下来运行什么"
msgid "This period has no journal entries posted to it and can be permanently deleted. This cannot be undone."
msgstr "此期间未过账任何日记账分录,可以永久删除。此操作无法撤销。"
+msgid "this purchase order"
+msgstr "此采购订单"
+
msgid "This Quarter"
msgstr "本季度"