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.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
feat(inventory): find the purchase order for a delivery on Receiving (#2044)
Brad Barbin00236111f32c
diff --git a/.ai/lessons.md b/.ai/lessons.mdindex 877e386216..2a02a15352 100644--- a/.ai/lessons.md+++ b/.ai/lessons.md@@ -4099,3 +4099,14 @@ The write was then removed (nothing reads it), so the rail always starts collaps**Rule:** Do not promise a closed-app badge on macOS Chrome. Test the badge with the app hidden (⌘H), not closed, and test the closed case on a platform meant to keep it (an iPhone Home Screen app) before calling it broken.**Applies to:** `apps/erp/app/hooks/useAppBadge.ts`, `apps/erp/public/service-worker.js`, the `send-push` badge count.++## `setGenericQueryFilters` erases a query's row type++**Context:** Inventory → Receiving read a view through `setGenericQueryFilters` and its route annotated the rows with a hand-written type (2026-10-26).++**Problem:** The helper's signature is typed loosely (it carries `@ts-expect-error`), so whatever it returns awaits to rows of type `any`. An annotation on those rows is an unchecked cast: renaming a column in the select string, or dropping it from the view, compiles clean and renders blank. Types in `types.ts` derived through `ReturnType<typeof getX>` are `any` the same way.++**Rule:** Keep the typed builder. Assign the helper's result back to the query variable (`query = setGenericQueryFilters(query, { filters })`), which keeps the variable's declared type, then apply the sort and `.range()` on it directly. Derive the row type from that function in `types.ts`, and narrow a view's never-null keys once at the loader boundary rather than guarding them in components.++**Applies to:** list reads in `apps/erp/app/modules/*/*.service.ts` that call `setGenericQueryFilters`, and the `types.ts` row types derived from them.+diff --git a/.claude/rules/shipments-receipts-ui-patterns.md b/.claude/rules/shipments-receipts-ui-patterns.mdindex 17f99be494..d9968139a1 100644--- a/.claude/rules/shipments-receipts-ui-patterns.md+++ b/.claude/rules/shipments-receipts-ui-patterns.md@@ -11,7 +11,14 @@ paths:Outbound (`shipment`) and inbound (`receipt`) documents are header + lines. They mirroreach other closely. UI lives in `apps/erp/app/modules/inventory/ui/{Shipments,Receipts}/`;routes in `apps/erp/app/routes/x+/{shipment,receipt}+/` (NOT under `inventory+/` — that-only holds the two list routes `shipments.tsx` / `receipts.tsx`).+only holds the two list routes `shipments.tsx` / `receipts.tsx`, and `receiving.tsx`).++**Inventory → Receiving** (`inventory+/receiving.tsx`, `ui/Receiving/ReceivingTable.tsx`)+is how a clerk finds the purchase order a delivery belongs to: the open lines of the+`purchaseOrderLinesToReceive` view, grouped by order and searched by anything on the+packing slip. Its Receive button posts to `receipt+/new.tsx` exactly as the PO header's+does; an order with a Draft receipt opens that receipt instead. See the inventory+module's AGENTS.md (Key Service Functions).<!-- UNVERIFIED: warehouse transfers are a separate system (modules/inventory/ui/WarehouseTransfers, routes x+/warehouse-transfer+/) — out of scope for this rule. -->## Routes (per document, e.g. `shipment+/`)diff --git a/apps/erp/app/components/Table/Table.tsx b/apps/erp/app/components/Table/Table.tsxindex 09185e0ad9..68892ec5bb 100644--- a/apps/erp/app/components/Table/Table.tsx+++ b/apps/erp/app/components/Table/Table.tsx@@ -23,6 +23,7 @@ import {Thead,Tr,useEscape,+ useIsomorphicLayoutEffect,useMount,useOutsideClick,useViewport,@@ -166,6 +167,8 @@ interface TableProps<T extends object> {// Renders a full-width header row above each run of consecutive rows that// share a key (e.g. a report grouped by date). Grouping follows `data`'s// order, so the caller sorts by the key; `header` receives the run's rows.+ // The header is as wide as the visible table and stays in view when it+ // scrolls sideways, so it can put actions at its right edge.groupRowsBy?: {key: (row: T) => string;header: (rows: T[]) => ReactNode;@@ -332,11 +335,15 @@ const Table = <T extends object>({}: TableProps<T>) => {const { t } = useLingui();const tableContainerRef = useRef<HTMLDivElement>(null);- // Visible width of the scroll container, for `pinExpandedRows`.+ // Visible width of the scroll container, for `pinExpandedRows` and the+ // `groupRowsBy` header rows: both stay in view as the table scrolls sideways.+ // Measured before paint, so a group header never shows at its content width+ // first and then jumps.const [containerWidth, setContainerWidth] = useState(0);- useEffect(() => {+ const measureContainer = pinExpandedRows || !!groupRowsBy;+ useIsomorphicLayoutEffect(() => {const el = tableContainerRef.current;- if (!pinExpandedRows || !el || typeof ResizeObserver === "undefined") {+ if (!measureContainer || !el || typeof ResizeObserver === "undefined") {return;}const update = () => setContainerWidth(el.clientWidth);@@ -344,7 +351,7 @@ const Table = <T extends object>({const observer = new ResizeObserver(update);observer.observe(el);return () => observer.disconnect();- }, [pinExpandedRows]);+ }, [measureContainer]);const { currentView, view } = useSavedViews();@@ -1555,7 +1562,19 @@ const Table = <T extends object>({colSpan={visibleColumns.length}className="p-0 bg-muted/40 border-b border-border">- <div className="sticky left-0 w-fit">+ {/* As wide as the visible table, so a header+ can put its actions at the right edge. */}+ <div+ className={cn(+ "sticky left-0",+ containerWidth === 0 && "w-fit"+ )}+ style={+ containerWidth > 0+ ? { width: containerWidth }+ : undefined+ }+ >{groupRowsBy.header(groupRows)}</div></Td>diff --git a/apps/erp/app/modules/inventory/AGENTS.md b/apps/erp/app/modules/inventory/AGENTS.mdindex 232a0b10a9..d52f5b1335 100644--- a/apps/erp/app/modules/inventory/AGENTS.md+++ b/apps/erp/app/modules/inventory/AGENTS.md@@ -49,6 +49,7 @@ pnpm exec turbo run typecheck --filter=erp # the app's package name is "erp",| `storageType` | Storage unit type definitions (capacity, constraints) || `trackedEntity` | Serial/batch/lot instances with readableId, status, quantity, expirationDate || `receipt` / `receiptLine` | Inbound documents from POs or production |+| `purchaseOrderLinesToReceive` (view) | The item lines (Part, Material, Tool, Fixture, Consumable — what `receiptFromPurchaseOrder` builds a receipt from) of purchase orders in `To Receive` / `To Receive and Invoice`, with supplier, reference, tracking number, item and supplier part. `searchText` holds each searchable value lower-cased with everything but letters and digits removed, joined with `\|`, so a search word never spans two values. Read by Inventory → Receiving || `receiptFixedAssetLine` | One fixed asset per row on a receipt: `purchaseOrderLineId` (a PO receipt) XOR `rentalAgreementLineId` (a rental receipt; CHECK `receiptFixedAssetLine_source_check`), `received`, `serialNumber`. The rental return fields: `meter`, `notes`, `takeOutOfService` + `outOfServiceReason` (CHECK: a tick needs a reason; the UI saves both as one `outOfService` field), `residualDestination` (`Fleet` / `Inventory`, a `Sale` line only). Edited through `updateReceiptFixedAssetLine` (`receiptFixedAssetLineUpdateValidator`), which refuses a line on a non-Draft receipt || `shipment` / `shipmentLine` | Outbound documents to customers || `shipmentFixedAssetLine` | One fixed asset per row on a shipment: `salesOrderLineId` (a sales order shipment) XOR `rentalAgreementLineId` (a rental shipment; CHECK `shipmentFixedAssetLine_source_check`), `shipped`, `serialNumber`, and `meter` (a rental unit's meter out). Edited through `updateShipmentFixedAssetLine` (`shipmentFixedAssetLineUpdateValidator`), which refuses a line on a non-Draft shipment. A reader that means a sales order line filters `salesOrderLineId IS NOT NULL` |@@ -105,6 +106,7 @@ A blocking rule is data, not an error: `post`, `create`, `setStatus` and `adjust- `getStorageUnit(s)` / `getStorageUnitTree` / `getStorageUnitsTreeForLocation` — storage hierarchy- `getAvailableTrackedEntities` — calls `get_available_tracked_entities` RPC- `getReceipts` / `getReceiptLines` / `reconcileReceiptSerialEntities` — receipt management. `reconcileReceiptSerialEntities` (Kysely, its own transaction; `reconcileReceiptSerialsInTransaction` inside a caller's) drops serials beyond the received quantity (run on post, and in the same transaction as a quantity change in `updateReceiptLines`) and returns the lines still missing serials, which the post refuses+- `getPurchaseOrderLinesToReceive` / `getOpenPurchaseOrdersForItems` / `getDraftReceiptsForPurchaseOrders` — Inventory → Receiving (`x+/inventory+/receiving.tsx`, `ui/Receiving/ReceivingTable.tsx`): find the purchase order a delivery belongs to by anything on the packing slip. Every search word must occur in `searchText` (`receivingSearchTerms`, `inventory.utils.ts`, normalizes the same way; `receivingSearchMatches` highlights what matched). Rows group by order, oldest first, so the list's sort is fixed. Receive posts to `createReceipt` (`receipt+/new.tsx`) like the PO header; an order with a Draft receipt offers that receipt instead. The route needs `view` on inventory AND purchasing: the view's rows are RLS-gated by `purchasing_view`- `releaseReceiptSerialEntities` (`@carbon/database/receipt-serials`, shared with the receipt line split, `receiptLineSplit` in `shared.service.ts`) — the one way a receipt serial is removed, run inside a Kysely transaction: an entity with no `itemLedger` history is deleted, one with history only loses its receipt link in one set-based update. A serial box save is planned by the pure `planSerialBoxWrite` (`inventory.models.ts`)- `getShipments` / `getShipmentLines` / `getShipmentRelatedItems` — shipment management- `getRentalShipmentLines` / `getRentalReceiptLines` — a rental document's asset lines with their rental line, fleet asset, item and tracked entity; the `$shipmentId.tsx` / `$receiptId.tsx` loaders call them for the `'Rental Agreement'` source and pass them as `rentalLines` (sorted by asset id, else unit name) to `ShipmentRentalLineItem` / `ReceiptRentalLineItem`. Both readers order by `createdAt, id`: a document's units are inserted in one statement and share a `createdAt`diff --git a/apps/erp/app/modules/inventory/inventory.service.ts b/apps/erp/app/modules/inventory/inventory.service.tsindex afdcf00f6f..70c6dd3802 100644--- a/apps/erp/app/modules/inventory/inventory.service.ts+++ b/apps/erp/app/modules/inventory/inventory.service.ts@@ -22,6 +22,7 @@ import {} from "@carbon/api/service-fn.server";import type { Database, Json } from "@carbon/database";import {+ fetchAllByIds,fetchAllFromTable,getCompanyTimeZone,journalReference@@ -224,7 +225,11 @@ import {reconcileReceiptLineSerials,shippingCarrierType} from "./inventory.models";-import { clampDepth, writeOffRestoreQuantity } from "./inventory.utils";+import {+ clampDepth,+ receivingSearchTerms,+ writeOffRestoreQuantity+} from "./inventory.utils";import { renderPackingSlip } from "./packing-slip.pdf";import {effectiveSuccessorId,@@ -854,6 +859,85 @@ export async function getReceipts(return query;}+/**+ * The purchase order lines Receiving searches: lines of orders waiting to be+ * received and not fully received, oldest order first and in line order within+ * it, so the list groups by order (its sort is fixed). Every search word must+ * occur in one of the line's values, case, spaces and punctuation ignored+ * (`receivingSearchTerms`).+ */+export async function getPurchaseOrderLinesToReceive(+ client: SupabaseClient<Database>,+ companyId: string,+ args: Omit<GenericQueryFilters, "sorts"> & { search: string | null }+) {+ let query = client+ .from("purchaseOrderLinesToReceive")+ .select(+ "id, purchaseOrderId, purchaseOrderReadableId, revisionId, orderDate, supplierId, supplierName, supplierReference, trackingNumber, locationId, itemId, itemReadableId, itemName, itemType, thumbnailPath, description, supplierPartId, purchaseQuantity, quantityReceived, quantityToReceive, purchaseUnitOfMeasureCode, promisedDate",+ { count: LIST_COUNT }+ )+ .eq("companyId", companyId)+ .eq("receivedComplete", false);++ for (const term of receivingSearchTerms(args.search)) {+ query = query.ilike("searchText", `%${term}%`);+ }+ // Filters only: assigned back so the select keeps its row type.+ query = setGenericQueryFilters(query, { filters: args.filters });++ return query+ .order("orderDate", { ascending: true })+ .order("purchaseOrderReadableId", { ascending: true })+ .order("sortOrder", { ascending: true })+ .order("id", { ascending: true })+ .range(args.offset, args.offset + args.limit - 1);+}++/**+ * Every order still waiting on these items, so Receiving can say a part is+ * also open on another order.+ */+export async function getOpenPurchaseOrdersForItems(+ client: SupabaseClient<Database>,+ companyId: string,+ itemIds: string[]+) {+ return fetchAllByIds(itemIds, (batch) =>+ client+ .from("purchaseOrderLinesToReceive")+ .select(+ "id, itemId, purchaseOrderId, purchaseOrderReadableId, revisionId"+ )+ .eq("companyId", companyId)+ .eq("receivedComplete", false)+ .in("itemId", batch)+ .order("id")+ );+}++/**+ * The Draft receipts already started for these purchase orders, oldest first,+ * so Receiving opens one instead of starting a second.+ */+export async function getDraftReceiptsForPurchaseOrders(+ client: SupabaseClient<Database>,+ companyId: string,+ purchaseOrderIds: string[]+) {+ return fetchAllByIds(purchaseOrderIds, (batch) =>+ client+ .from("receipt")+ .select("id, receiptId, sourceDocumentId")+ .eq("companyId", companyId)+ .eq("sourceDocument", "Purchase Order")+ .eq("status", "Draft")+ .in("sourceDocumentId", batch)+ .order("createdAt", { ascending: true })+ .order("id", { ascending: true })+ );+}+export async function getReceipt(client: SupabaseClient<Database>,receiptId: stringdiff --git a/apps/erp/app/modules/inventory/inventory.utils.test.ts b/apps/erp/app/modules/inventory/inventory.utils.test.tsindex f112969a40..712079d358 100644--- a/apps/erp/app/modules/inventory/inventory.utils.test.ts+++ b/apps/erp/app/modules/inventory/inventory.utils.test.ts@@ -5,6 +5,8 @@import { describe, expect, it } from "vitest";import {isShippableEntityStatus,+ receivingSearchMatches,+ receivingSearchTerms,shippableEntityStatuses,writeOffRestoreQuantity} from "./inventory.utils";@@ -72,3 +74,40 @@ describe("writeOffRestoreQuantity", () => {).toBe(2);});});++// The Receiving search filters on the view's normalized values and highlights+// with the same rule, so what matched is what is marked.+describe("receivingSearchTerms", () => {+ it("ignores case, spaces and punctuation inside a word", () => {+ expect(receivingSearchTerms("RAB-514")).toEqual(["rab514"]);+ expect(receivingSearchTerms(" Monton P-0000071.01 ")).toEqual([+ "monton",+ "p000007101"+ ]);+ });++ it("drops words that are only punctuation", () => {+ expect(receivingSearchTerms("- / .")).toEqual([]);+ expect(receivingSearchTerms(null)).toEqual([]);+ });+});++describe("receivingSearchMatches", () => {+ it("marks the original characters a normalized term matched", () => {+ expect(receivingSearchMatches("RAB-514", ["rab514"])).toEqual([[0, 7]]);+ expect(receivingSearchMatches("TI -200", ["ti200"])).toEqual([[0, 8]]);+ });++ it("merges overlapping matches of several terms", () => {+ expect(+ receivingSearchMatches("BEARING, 7000", ["bear", "ring", "7000"])+ ).toEqual([+ [0, 7],+ [9, 13]+ ]);+ });++ it("marks nothing without a match", () => {+ expect(receivingSearchMatches("MTSV708", ["7000"])).toEqual([]);+ });+});diff --git a/apps/erp/app/modules/inventory/inventory.utils.ts b/apps/erp/app/modules/inventory/inventory.utils.tsindex fb23db9546..e246193d58 100644--- a/apps/erp/app/modules/inventory/inventory.utils.ts+++ b/apps/erp/app/modules/inventory/inventory.utils.ts@@ -58,6 +58,70 @@ export function isShippableEntityStatus();}+const NOT_ALPHANUMERIC = /[^\p{L}\p{N}]+/gu;++/**+ * The words of a Receiving search, as `purchaseOrderLinesToReceive.searchText`+ * stores its values: lower-cased, with everything but letters and digits+ * removed. A packing slip prints RAB-514 where Carbon holds RAB514, and both+ * read rab514. Every word must match.+ */+export function receivingSearchTerms(+ search: string | null | undefined+): string[] {+ if (!search) return [];+ return search+ .split(/\s+/)+ .map((word) => word.toLowerCase().replace(NOT_ALPHANUMERIC, ""))+ .filter(Boolean);+}++/**+ * Where the search terms occur in `text`, matched the way the search matches+ * (case, spaces and punctuation ignored): sorted, merged `[start, end)` ranges+ * of `text`, so a highlight covers RAB-514 for the term rab514.+ */+export function receivingSearchMatches(+ text: string,+ terms: string[]+): [number, number][] {+ if (!text || terms.length === 0) return [];++ // The normalized text, and for each of its characters the index in `text`+ // it came from.+ let normalized = "";+ const source: number[] = [];+ for (let i = 0; i < text.length; i++) {+ const lower = text[i]!.toLowerCase().replace(NOT_ALPHANUMERIC, "");+ for (const char of lower) {+ normalized += char;+ source.push(i);+ }+ }++ const ranges: [number, number][] = [];+ for (const term of terms) {+ let from = normalized.indexOf(term);+ while (from !== -1) {+ const end = from + term.length;+ ranges.push([source[from]!, source[end - 1]! + 1]);+ from = normalized.indexOf(term, end);+ }+ }++ ranges.sort((a, b) => a[0] - b[0]);+ const merged: [number, number][] = [];+ for (const range of ranges) {+ const last = merged[merged.length - 1];+ if (last && range[0] <= last[1]) {+ last[1] = Math.max(last[1], range[1]);+ } else {+ merged.push([...range]);+ }+ }+ return merged;+}+export async function getReceiptTracking(client: SupabaseClient<Database>,receiptId: string,diff --git a/apps/erp/app/modules/inventory/types.ts b/apps/erp/app/modules/inventory/types.tsindex 64c7848537..730decffe7 100644--- a/apps/erp/app/modules/inventory/types.ts+++ b/apps/erp/app/modules/inventory/types.ts@@ -12,6 +12,7 @@ import type {getInventoryValuationTieOut,getItemLedgerPage,getKanbans,+ getPurchaseOrderLinesToReceive,getReceiptLines,getReceipts,getShipmentLines,@@ -226,3 +227,31 @@ export type IssueContainment = {priority: string | null;trackedEntityId: string;};++export type PurchaseOrderLineToReceive = NonNullable<+ Awaited<ReturnType<typeof getPurchaseOrderLinesToReceive>>["data"]+>[number];++/** Another order still waiting on a line's item. */+export type ReceivingOrder = {+ id: string;+ readableId: string | null;+ revisionId: number | null;+};++/** A Draft receipt already started for an order. */+export type ReceivingDraftReceipt = {+ id: string;+ receiptId: string;+};++/**+ * A row of Inventory → Receiving: a line to receive (the view's keys are never+ * null; the generated view type cannot say so), with the other orders still+ * waiting on its item.+ */+export type ReceivingRow = PurchaseOrderLineToReceive & {+ id: string;+ purchaseOrderId: string;+ alsoOpenOn: ReceivingOrder[];+};diff --git a/apps/erp/app/modules/inventory/ui/Receiving/ReceivingTable.tsx b/apps/erp/app/modules/inventory/ui/Receiving/ReceivingTable.tsxnew file mode 100644index 0000000000..a2926298c9--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Receiving/ReceivingTable.tsx@@ -0,0 +1,444 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,+// including ports, remain AGPLv3; serving them over a network requires releasing their source.++import { getPurchaseOrderDisplayId } from "@carbon/documents/utils";+import { Button, Copy, HStack, VStack } from "@carbon/react";+import { Trans, useLingui } from "@lingui/react/macro";+import type { ColumnDef } from "@tanstack/react-table";+import { Fragment, memo, useMemo } from "react";+import {+ LuBookMarked,+ LuCalendar,+ LuContainer,+ LuHandCoins,+ LuHash,+ LuMapPin,+ LuText+} from "react-icons/lu";+import { Link, useNavigation } from "react-router";+import {+ DateTime,+ exportOnlyColumn,+ Hyperlink,+ ItemThumbnail,+ RevisionSuffix,+ Table+} from "~/components";+import { Enumerable } from "~/components/Enumerable";+import { useLocations } from "~/components/Form/Location";+import { usePermissions, useQuantityFormatter, useUrlParams } from "~/hooks";+import {+ receivingSearchMatches,+ receivingSearchTerms+} from "~/modules/inventory/inventory.utils";+import type {+ ReceivingDraftReceipt,+ ReceivingOrder,+ ReceivingRow+} from "~/modules/inventory/types";+import { usePurchaseOrder } from "~/modules/purchasing/ui/PurchaseOrder/usePurchaseOrder";+import type { ItemType } from "~/modules/shared/types";+import { useSuppliers } from "~/stores";+import { path } from "~/utils/path";++type ReceivingTableProps = {+ rows: ReceivingRow[];+ count: number;+ draftReceiptByOrder: Record<string, ReceivingDraftReceipt>;+};++/** "PO000036-1": the order's readable id with its revision. */+function readableOrderId(row: ReceivingRow) {+ return getPurchaseOrderDisplayId({+ purchaseOrderId: row.purchaseOrderReadableId,+ revisionId: row.revisionId+ });+}++/** `text` with every part a search word matched marked. */+function Highlight({ text, terms }: { text: string | null; terms: string[] }) {+ if (!text) return null;+ const ranges = receivingSearchMatches(text, terms);+ if (ranges.length === 0) return <>{text}</>;++ const parts: JSX.Element[] = [];+ let cursor = 0;+ for (const [start, end] of ranges) {+ if (start > cursor) {+ parts.push(<Fragment key={cursor}>{text.slice(cursor, start)}</Fragment>);+ }+ parts.push(+ <mark+ key={start}+ className="bg-yellow-200 dark:bg-yellow-900/50 text-inherit rounded-sm"+ >+ {text.slice(start, end)}+ </mark>+ );+ cursor = end;+ }+ if (cursor < text.length) {+ parts.push(<Fragment key={cursor}>{text.slice(cursor)}</Fragment>);+ }+ return <>{parts}</>;+}++/** "Also open on PO000037, PO000040", each order linked. The links are one+ * placeholder, so a translation can put them where its grammar needs. */+function AlsoOpenOn({ orders }: { orders: ReceivingOrder[] }) {+ const links = orders.map((order, index) => (+ <Fragment key={order.id}>+ {index > 0 && ", "}+ <Link+ to={path.to.purchaseOrderDetails(order.id)}+ className="hover:underline"+ >+ {order.readableId}+ <RevisionSuffix revisionId={order.revisionId} />+ </Link>+ </Fragment>+ ));+ return <Trans>Also open on {links}</Trans>;+}++const ReceivingTable = memo(+ ({ rows, count, draftReceiptByOrder }: ReceivingTableProps) => {+ const { t } = useLingui();+ const [params] = useUrlParams();+ const formatQuantity = useQuantityFormatter();+ const locations = useLocations();+ const [suppliers] = useSuppliers();++ const search = params.get("search");+ const terms = useMemo(() => receivingSearchTerms(search), [search]);++ const groupRowsBy = useMemo(+ () => ({+ key: (row: ReceivingRow) => row.purchaseOrderId,+ header: (group: ReceivingRow[]) => (+ <ReceivingOrderHeader+ row={group[0]!}+ terms={terms}+ draftReceipt={draftReceiptByOrder[group[0]!.purchaseOrderId]}+ />+ )+ }),+ [terms, draftReceiptByOrder]+ );++ const columns = useMemo<ColumnDef<ReceivingRow>[]>(+ () => [+ {+ accessorKey: "itemReadableId",+ header: t`Part`,+ cell: ({ row }) => (+ <HStack className="min-w-0">+ <ItemThumbnail+ size="sm"+ thumbnailPath={row.original.thumbnailPath}+ type={(row.original.itemType as ItemType | null) ?? undefined}+ />+ <Hyperlink+ to={path.to.purchaseOrderLine(+ row.original.purchaseOrderId,+ row.original.id+ )}+ >+ <span className="whitespace-nowrap">+ <Highlight text={row.original.itemReadableId} terms={terms} />+ </span>+ </Hyperlink>+ </HStack>+ ),+ meta: {+ mobile: "P1",+ icon: <LuBookMarked />+ }+ },+ {+ id: "name",+ header: t`Name`,+ cell: ({ row }) => {+ const name = row.original.itemName ?? row.original.description;+ const { alsoOpenOn } = row.original;+ return (+ <VStack spacing={0} className="min-w-0 max-w-[360px]">+ <span className="truncate w-full">+ <Highlight text={name} terms={terms} />+ </span>+ {row.original.description &&+ row.original.description !== name && (+ <span className="text-xs text-muted-foreground truncate w-full">+ <Highlight+ text={row.original.description}+ terms={terms}+ />+ </span>+ )}+ {alsoOpenOn.length > 0 && (+ <span className="text-xs text-muted-foreground truncate w-full">+ <AlsoOpenOn orders={alsoOpenOn} />+ </span>+ )}+ </VStack>+ );+ },+ meta: {+ mobile: "P2",+ icon: <LuText />,+ exportValue: (row) => row.itemName ?? row.description+ }+ },+ {+ accessorKey: "supplierPartId",+ header: t`Supplier Part`,+ cell: ({ row }) => (+ <span className="whitespace-nowrap">+ <Highlight text={row.original.supplierPartId} terms={terms} />+ </span>+ ),+ meta: {+ icon: <LuHash />+ }+ },+ {+ accessorKey: "purchaseQuantity",+ header: t`Ordered`,+ cell: ({ row }) =>+ row.original.purchaseQuantity === null ? null : (+ <span className="whitespace-nowrap tabular-nums">+ {formatQuantity(row.original.purchaseQuantity)}{" "}+ <span className="text-muted-foreground">+ {row.original.purchaseUnitOfMeasureCode}+ </span>+ </span>+ ),+ meta: {+ icon: <LuHash />+ }+ },+ {+ accessorKey: "quantityReceived",+ header: t`Received`,+ cell: ({ row }) => (+ <span className="tabular-nums">+ {formatQuantity(row.original.quantityReceived ?? 0)}+ </span>+ ),+ meta: {+ icon: <LuHash />+ }+ },+ {+ accessorKey: "quantityToReceive",+ header: t`To Receive`,+ cell: ({ row }) => (+ <span className="tabular-nums font-medium">+ {formatQuantity(row.original.quantityToReceive ?? 0)}+ </span>+ ),+ meta: {+ mobile: "P3",+ icon: <LuHash />+ }+ },+ {+ accessorKey: "promisedDate",+ header: t`Promised`,+ cell: ({ row }) => (+ <DateTime value={row.original.promisedDate} variant="date" />+ ),+ meta: {+ icon: <LuCalendar />+ }+ },+ {+ accessorKey: "locationId",+ header: t`Location`,+ cell: ({ row }) => {+ const location = locations.find(+ (option) => option.value === row.original.locationId+ );+ return location ? <Enumerable value={location.label} /> : null;+ },+ meta: {+ icon: <LuMapPin />,+ filter: {+ type: "static",+ options: locations.map((location) => ({+ value: location.value,+ label: <Enumerable value={location.label} />+ }))+ },+ exportValue: (row) =>+ locations.find((option) => option.value === row.locationId)+ ?.label ?? row.locationId+ }+ },+ {+ accessorKey: "supplierId",+ header: t`Supplier`,+ cell: ({ row }) => row.original.supplierName,+ meta: {+ icon: <LuContainer />,+ filter: {+ type: "static",+ options: (suppliers ?? []).map((supplier) => ({+ value: supplier.id,+ label: supplier.name+ }))+ },+ exportValue: (row) => row.supplierName+ }+ },+ // The order each line is grouped under — the band above the rows,+ // which the CSV has no other way to carry.+ exportOnlyColumn<ReceivingRow>({+ id: "purchaseOrderReadableId",+ header: t`Purchase Order`,+ value: (row) => readableOrderId(row)+ }),+ exportOnlyColumn<ReceivingRow>({+ id: "supplierReference",+ header: t`Supplier Reference`,+ value: (row) => row.supplierReference+ })+ ],+ [t, terms, formatQuantity, locations, suppliers]+ );++ return (+ <Table<ReceivingRow>+ data={rows}+ columns={columns}+ count={count}+ title={t`Receiving`}+ getRowId={(row) => row.id}+ defaultColumnPinning={{ left: ["itemReadableId"] }}+ defaultColumnVisibility={{+ quantityReceived: false,+ supplierId: false+ }}+ groupRowsBy={groupRowsBy}+ withSimpleSorting={false}+ sort={null}+ // The search is the page: keep the toolbar when nothing matches.+ isFiltered+ emptyState={+ <p className="text-sm text-muted-foreground">+ {search ? (+ <Trans>+ No open purchase order lines match your search. Every word must+ match; spaces and punctuation are ignored.+ </Trans>+ ) : (+ <Trans>No purchase orders are waiting to be received.</Trans>+ )}+ </p>+ }+ />+ );+ }+);++ReceivingTable.displayName = "ReceivingTable";++export default ReceivingTable;++/** The band above each order's lines: who it is from, and how to receive it. */+function ReceivingOrderHeader({+ row,+ terms,+ draftReceipt+}: {+ row: ReceivingRow;+ terms: string[];+ /** A Draft receipt already started for the order: opened, not doubled. */+ draftReceipt: ReceivingDraftReceipt | undefined;+}) {+ const { t } = useLingui();+ const permissions = usePermissions();+ const navigation = useNavigation();+ const { receive } = usePurchaseOrder();++ const purchaseOrderId = row.purchaseOrderId;+ const displayId = readableOrderId(row);+ const isReceiving =+ navigation.state !== "idle" &&+ navigation.formAction === path.to.newReceipt &&+ navigation.formData?.get("sourceDocumentId") === purchaseOrderId;++ // The order on the left, its receipt on the right.+ return (+ <div className="flex items-center justify-between gap-3 px-4 py-2">+ <div className="flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1">+ <HStack spacing={1} className="shrink-0">+ <Link+ to={path.to.purchaseOrderDetails(purchaseOrderId)}+ className="whitespace-nowrap text-sm font-medium hover:underline"+ >+ <Highlight text={row.purchaseOrderReadableId} terms={terms} />+ <RevisionSuffix revisionId={row.revisionId} />+ </Link>+ <Copy text={displayId} label={t`Copy purchase order number`} />+ </HStack>+ <span className="min-w-0 truncate text-sm">+ <Highlight text={row.supplierName} terms={terms} />+ </span>+ <span className="flex min-w-0 flex-wrap items-center gap-x-3 text-xs text-muted-foreground">+ {row.orderDate && (+ <span className="whitespace-nowrap">+ <Trans>Ordered</Trans>{" "}+ <DateTime value={row.orderDate} variant="date" />+ </span>+ )}+ {row.supplierReference && (+ <span className="whitespace-nowrap">+ <Trans>Reference</Trans>{" "}+ <span className="text-foreground">+ <Highlight text={row.supplierReference} terms={terms} />+ </span>+ </span>+ )}+ {row.trackingNumber && (+ <span className="whitespace-nowrap">+ <Trans>Tracking</Trans>{" "}+ <span className="text-foreground">+ <Highlight text={row.trackingNumber} terms={terms} />+ </span>+ </span>+ )}+ </span>+ </div>+ {draftReceipt ? (+ <Button+ asChild+ size="sm"+ variant="secondary"+ leftIcon={<LuHandCoins />}+ className="shrink-0"+ >+ <Link to={path.to.receiptDetails(draftReceipt.id)}>+ {draftReceipt.receiptId}+ </Link>+ </Button>+ ) : (+ <Button+ size="sm"+ variant="secondary"+ leftIcon={<LuHandCoins />}+ className="shrink-0"+ isLoading={isReceiving}+ isDisabled={+ !permissions.can("create", "inventory") ||+ navigation.state !== "idle"+ }+ onClick={() => receive({ id: purchaseOrderId })}+ >+ <Trans>Receive</Trans>+ </Button>+ )}+ </div>+ );+}diff --git a/apps/erp/app/modules/inventory/ui/useInventorySubmodules.tsx b/apps/erp/app/modules/inventory/ui/useInventorySubmodules.tsxindex b13ac2ccab..cf086e9f1d 100644--- a/apps/erp/app/modules/inventory/ui/useInventorySubmodules.tsx+++ b/apps/erp/app/modules/inventory/ui/useInventorySubmodules.tsx@@ -11,6 +11,7 @@ import {LuHandCoins,LuListChecks,LuNetwork,+ LuPackageSearch,LuQrCode,LuScanQrCode,LuShieldCheck,@@ -65,6 +66,13 @@ export default function useInventorySubmodules() {{name: t`Shipping & Receiving`,routes: [+ {+ name: t`Receiving`,+ to: path.to.receiving,+ icon: <LuPackageSearch />,+ // Open purchase order lines are only readable with purchasing view.+ permission: "purchasing"+ },{name: t`Receipts`,to: path.to.receipts,@@ -151,31 +159,19 @@ export default function useInventorySubmodules() {}];+ const isVisible = (route: AuthenticatedRouteGroup["routes"][number]) => {+ if (route.role) return permissions.is(route.role);+ if (route.permission) return permissions.can("view", route.permission);+ return true;+ };+return {groups: inventoryRoutes- .filter((group) => {- const filteredRoutes = group.routes.filter((route) => {- if (route.role) {- return permissions.is(route.role);- } else {- return true;- }- });-- return filteredRoutes.length > 0;- }).map((group) => ({...group,- routes: group.routes- .filter((route) => {- if (route.role) {- return permissions.is(route.role);- } else {- return true;- }- })- .map(addSavedViewsToRoutes)+ routes: group.routes.filter(isVisible).map(addSavedViewsToRoutes)}))+ .filter((group) => group.routes.length > 0)};}diff --git a/apps/erp/app/modules/shared/shared.service.ts b/apps/erp/app/modules/shared/shared.service.tsindex 30637a7c69..abffee19d1 100644--- a/apps/erp/app/modules/shared/shared.service.ts+++ b/apps/erp/app/modules/shared/shared.service.ts@@ -11648,6 +11648,8 @@ export async function createDocument(many(db, "purchaseOrderLine", {companyId,purchaseOrderId,+ // The `purchaseOrderLinesToReceive` view (Inventory →+ // Receiving) lists the same types: change both together.purchaseOrderLineType: ["Part","Material",diff --git a/apps/erp/app/routes/x+/inventory+/receiving.tsx b/apps/erp/app/routes/x+/inventory+/receiving.tsxnew file mode 100644index 0000000000..3f8ac39223--- /dev/null+++ b/apps/erp/app/routes/x+/inventory+/receiving.tsx@@ -0,0 +1,149 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,+// including ports, remain AGPLv3; serving them over a network requires releasing their source.++import { error } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import { getLogger } from "@carbon/logger";+import { VStack } from "@carbon/react";+import { redirect } from "@carbon/utils";+import { msg } from "@lingui/core/macro";+import type { LoaderFunctionArgs } from "react-router";+import { useLoaderData } from "react-router";+import {+ getDraftReceiptsForPurchaseOrders,+ getOpenPurchaseOrdersForItems,+ getPurchaseOrderLinesToReceive+} from "~/modules/inventory/inventory.service";+import type {+ ReceivingDraftReceipt,+ ReceivingOrder,+ ReceivingRow+} from "~/modules/inventory/types";+import ReceivingTable from "~/modules/inventory/ui/Receiving/ReceivingTable";+import type { Handle } from "~/utils/handle";+import { path } from "~/utils/path";+import { getGenericQueryFilters } from "~/utils/query";++export const handle: Handle = {+ realtime: ["purchaseOrder", "receipt"],+ breadcrumb: msg`Receiving`,+ to: path.to.receiving+};++const logger = getLogger("erp", "inventory", "receiving");++export async function loader({ request }: LoaderFunctionArgs) {+ // Purchase order lines are only readable with purchasing view, so without+ // it the list would read as "nothing to receive".+ const { client, companyId } = await requirePermissions(request, {+ view: ["inventory", "purchasing"]+ });++ const searchParams = new URL(request.url).searchParams;+ const search = searchParams.get("search");+ const { limit, offset, filters } = getGenericQueryFilters(searchParams);++ const lines = await getPurchaseOrderLinesToReceive(client, companyId, {+ search,+ limit,+ offset,+ filters+ });++ if (lines.error) {+ logger.error("Failed to load purchase order lines to receive", {+ companyId,+ error: lines.error+ });+ throw redirect(+ path.to.inventory,+ await flash(+ request,+ error(lines.error, "Failed to load purchase order lines to receive")+ )+ );+ }++ // The view's keys are never null; the generated view type cannot say so.+ const openLines = (lines.data ?? []).flatMap((line) =>+ line.id && line.purchaseOrderId+ ? [{ ...line, id: line.id, purchaseOrderId: line.purchaseOrderId }]+ : []+ );+ const itemIds = [+ ...new Set(openLines.flatMap((line) => (line.itemId ? [line.itemId] : [])))+ ];+ const purchaseOrderIds = [+ ...new Set(openLines.map((line) => line.purchaseOrderId))+ ];++ const [otherOrders, draftReceipts] = await Promise.all([+ getOpenPurchaseOrdersForItems(client, companyId, itemIds),+ getDraftReceiptsForPurchaseOrders(client, companyId, purchaseOrderIds)+ ]);++ // Both only add context to the list, so a failed read leaves it out.+ if (otherOrders.error) {+ logger.warn("Failed to load other open orders for items", {+ companyId,+ error: otherOrders.error+ });+ }+ if (draftReceipts.error) {+ logger.warn("Failed to load draft receipts for purchase orders", {+ companyId,+ error: draftReceipts.error+ });+ }++ const ordersByItem = new Map<string, Map<string, ReceivingOrder>>();+ for (const order of otherOrders.data ?? []) {+ if (!order.itemId || !order.purchaseOrderId) continue;+ const orders = ordersByItem.get(order.itemId) ?? new Map();+ orders.set(order.purchaseOrderId, {+ id: order.purchaseOrderId,+ readableId: order.purchaseOrderReadableId,+ revisionId: order.revisionId+ });+ ordersByItem.set(order.itemId, orders);+ }++ const rows: ReceivingRow[] = openLines.map((line) => ({+ ...line,+ alsoOpenOn: [...(ordersByItem.get(line.itemId ?? "")?.values() ?? [])]+ .filter((order) => order.id !== line.purchaseOrderId)+ .sort((a, b) => (a.readableId ?? "").localeCompare(b.readableId ?? ""))+ }));++ // The oldest Draft per order: the one its Receive button opens.+ const draftReceiptByOrder: Record<string, ReceivingDraftReceipt> = {};+ for (const receipt of draftReceipts.data ?? []) {+ if (!receipt.sourceDocumentId) continue;+ draftReceiptByOrder[receipt.sourceDocumentId] ??= {+ id: receipt.id,+ receiptId: receipt.receiptId+ };+ }++ return {+ rows,+ count: lines.count ?? 0,+ draftReceiptByOrder+ };+}++export default function ReceivingRoute() {+ const { rows, count, draftReceiptByOrder } = useLoaderData<typeof loader>();++ return (+ <VStack spacing={0} className="h-full">+ <ReceivingTable+ rows={rows}+ count={count}+ draftReceiptByOrder={draftReceiptByOrder}+ />+ </VStack>+ );+}diff --git a/apps/erp/app/utils/path.ts b/apps/erp/app/utils/path.tsindex d515560b3d..9747423b65 100644--- a/apps/erp/app/utils/path.ts+++ b/apps/erp/app/utils/path.ts@@ -2226,6 +2226,7 @@ export const path = {receiptVoid: (id: string) => generatePath(`${x}/receipt/${id}/void`),receivables: `${x}/invoicing/receivables`,receivablesAdjust: `${x}/invoicing/receivables/adjust`,+ receiving: `${x}/inventory/receiving`,refreshSession: "/refresh-session",// Reimbursements — employee expense payables imported from a spend tool.// The list lives under invoicing (it is an AP nav entry); the document is adiff --git a/docs/content/docs/reference/receipts.mdx b/docs/content/docs/reference/receipts.mdxindex 49b18dd65b..3a7c80ea5f 100644--- a/docs/content/docs/reference/receipts.mdx+++ b/docs/content/docs/reference/receipts.mdx@@ -7,6 +7,12 @@ A **receipt** records incoming goods from a <Term id="purchase-order">purchase oEach receipt line references the purchase-order line it fulfills. Posting increases inventory and the order line's received quantity. Its journal debits inventory—or <Term id="wip">work-in-process</Term> for outside processing—and credits a <Term id="gr-ir">goods-received-not-invoiced</Term> accrual that the supplier invoice later clears.+## Find the purchase order for a delivery++**Inventory → Receiving** lists every line still to be received on a purchase order waiting to be received, grouped by order, oldest first. Search with whatever the packing slip shows: order number, supplier, part number or name, the supplier's part number, the supplier's reference, or the tracking number. Every word must match, and case, spaces and punctuation are ignored, so `RAB-514` finds `RAB514`.++Each order has a **Receive** button that creates its receipt. An order that already has a Draft receipt shows that receipt's number instead, and opens it. The page needs view access to both Inventory and Purchasing.+## Fields<FieldTable>diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.tsindex 1c26ce7887..0c79b40661 100644--- a/packages/database/src/swagger-docs-schema.ts+++ b/packages/database/src/swagger-docs-schema.ts@@ -46827,6 +46827,135 @@ export default {tags: ["scriptRun"]}},+ "/purchaseOrderLinesToReceive": {+ get: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.id"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.companyId"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.purchaseOrderId"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.purchaseOrderReadableId"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.revisionId"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.status"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.purchaseOrderType"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.orderDate"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.supplierId"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.supplierName"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.supplierReference"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.trackingNumber"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.locationId"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.purchaseOrderLineType"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.itemId"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.itemReadableId"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.itemName"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.itemType"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.thumbnailPath"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.description"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.supplierPartId"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.purchaseQuantity"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.quantityReceived"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.quantityToReceive"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.purchaseUnitOfMeasureCode"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.receivedComplete"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.promisedDate"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.sortOrder"+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderLinesToReceive.searchText"+ },+ {+ $ref: "#/parameters/select"+ },+ {+ $ref: "#/parameters/order"+ },+ {+ $ref: "#/parameters/range"+ },+ {+ $ref: "#/parameters/rangeUnit"+ },+ {+ $ref: "#/parameters/offset"+ },+ {+ $ref: "#/parameters/limit"+ },+ {+ $ref: "#/parameters/preferCount"+ }+ ],+ responses: {+ "200": {+ description: "OK",+ schema: {+ items: {+ $ref: "#/definitions/purchaseOrderLinesToReceive"+ },+ type: "array"+ }+ },+ "206": {+ description: "Partial Content"+ }+ },+ tags: ["purchaseOrderLinesToReceive"]+ }+ },"/currencies": {get: {parameters: [@@ -140146,6 +140275,163 @@ export default {},type: "object"},+ purchaseOrderLinesToReceive: {+ properties: {+ id: {+ description: "Note:\nThis is a Primary Key.<pk/>",+ format: "text",+ type: "string"+ },+ companyId: {+ format: "text",+ type: "string"+ },+ purchaseOrderId: {+ description: "Note:\nThis is a Primary Key.<pk/>",+ format: "text",+ type: "string"+ },+ purchaseOrderReadableId: {+ format: "text",+ type: "string"+ },+ revisionId: {+ format: "integer",+ type: "integer"+ },+ status: {+ enum: [+ "Draft",+ "To Review",+ "Rejected",+ "To Receive",+ "To Receive and Invoice",+ "To Invoice",+ "Completed",+ "Closed",+ "Planned",+ "Needs Approval"+ ],+ format: 'public."purchaseOrderStatus"',+ type: "string"+ },+ purchaseOrderType: {+ enum: ["Purchase", "Return", "Outside Processing"],+ format: 'public."purchaseOrderType"',+ type: "string"+ },+ orderDate: {+ format: "date",+ type: "string"+ },+ supplierId: {+ format: "text",+ type: "string"+ },+ supplierName: {+ format: "text",+ type: "string"+ },+ supplierReference: {+ format: "text",+ type: "string"+ },+ trackingNumber: {+ format: "text",+ type: "string"+ },+ locationId: {+ format: "text",+ type: "string"+ },+ purchaseOrderLineType: {+ enum: [+ "Comment",+ "G/L Account",+ "Fixed Asset",+ "Part",+ "Material",+ "Tool",+ "Service",+ "Consumable",+ "Fixture"+ ],+ format: 'public."purchaseOrderLineType"',+ type: "string"+ },+ itemId: {+ description:+ "Note:\nThis is a Foreign Key to `item.id`.<fk table='item' column='id'/>",+ format: "text",+ type: "string"+ },+ itemReadableId: {+ format: "text",+ type: "string"+ },+ itemName: {+ format: "text",+ type: "string"+ },+ itemType: {+ enum: [+ "Part",+ "Material",+ "Tool",+ "Service",+ "Consumable",+ "Fixture"+ ],+ format: 'public."itemType"',+ type: "string"+ },+ thumbnailPath: {+ format: "text",+ type: "string"+ },+ description: {+ format: "text",+ type: "string"+ },+ supplierPartId: {+ format: "text",+ type: "string"+ },+ purchaseQuantity: {+ format: "numeric",+ type: "number"+ },+ quantityReceived: {+ format: "numeric",+ type: "number"+ },+ quantityToReceive: {+ format: "numeric",+ type: "number"+ },+ purchaseUnitOfMeasureCode: {+ format: "text",+ type: "string"+ },+ receivedComplete: {+ format: "boolean",+ type: "boolean"+ },+ promisedDate: {+ format: "date",+ type: "string"+ },+ sortOrder: {+ format: "double precision",+ type: "number"+ },+ searchText: {+ format: "text",+ type: "string"+ }+ },+ type: "object"+ },currencies: {properties: {id: {@@ -192630,6 +192916,189 @@ export default {in: "query",type: "string"},+ "body.purchaseOrderLinesToReceive": {+ name: "purchaseOrderLinesToReceive",+ description: "purchaseOrderLinesToReceive",+ required: false,+ in: "body",+ schema: {+ $ref: "#/definitions/purchaseOrderLinesToReceive"+ }+ },+ "rowFilter.purchaseOrderLinesToReceive.id": {+ name: "id",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.companyId": {+ name: "companyId",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.purchaseOrderId": {+ name: "purchaseOrderId",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.purchaseOrderReadableId": {+ name: "purchaseOrderReadableId",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.revisionId": {+ name: "revisionId",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.status": {+ name: "status",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.purchaseOrderType": {+ name: "purchaseOrderType",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.orderDate": {+ name: "orderDate",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.supplierId": {+ name: "supplierId",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.supplierName": {+ name: "supplierName",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.supplierReference": {+ name: "supplierReference",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.trackingNumber": {+ name: "trackingNumber",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.locationId": {+ name: "locationId",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.purchaseOrderLineType": {+ name: "purchaseOrderLineType",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.itemId": {+ name: "itemId",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.itemReadableId": {+ name: "itemReadableId",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.itemName": {+ name: "itemName",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.itemType": {+ name: "itemType",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.thumbnailPath": {+ name: "thumbnailPath",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.description": {+ name: "description",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.supplierPartId": {+ name: "supplierPartId",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.purchaseQuantity": {+ name: "purchaseQuantity",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.quantityReceived": {+ name: "quantityReceived",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.quantityToReceive": {+ name: "quantityToReceive",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.purchaseUnitOfMeasureCode": {+ name: "purchaseUnitOfMeasureCode",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.receivedComplete": {+ name: "receivedComplete",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.promisedDate": {+ name: "promisedDate",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.sortOrder": {+ name: "sortOrder",+ required: false,+ in: "query",+ type: "string"+ },+ "rowFilter.purchaseOrderLinesToReceive.searchText": {+ name: "searchText",+ required: false,+ in: "query",+ type: "string"+ },"body.currencies": {name: "currencies",description: "currencies",diff --git a/packages/database/src/types.ts b/packages/database/src/types.tsindex 0bd23b56d4..88e0ac1134 100644--- a/packages/database/src/types.ts+++ b/packages/database/src/types.ts@@ -39119,6 +39119,13 @@ export type Database = {referencedRelation: "purchaseOrder"referencedColumns: ["id"]},+ {+ foreignKeyName: "nonConformancePurchaseOrderLine_purchaseOrderId_fkey"+ columns: ["purchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["purchaseOrderId"]+ },{foreignKeyName: "nonConformancePurchaseOrderLine_purchaseOrderId_fkey"columns: ["purchaseOrderId"]@@ -39154,6 +39161,13 @@ export type Database = {referencedRelation: "purchaseOrderLines"referencedColumns: ["id"]},+ {+ foreignKeyName: "nonConformancePurchaseOrderLine_purchaseOrderLineId_fkey"+ columns: ["purchaseOrderLineId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["id"]+ },{foreignKeyName: "nonConformancePurchaseOrderLine_updatedBy_fkey"columns: ["updatedBy"]@@ -44840,6 +44854,13 @@ export type Database = {referencedRelation: "purchaseOrderLines"referencedColumns: ["id"]},+ {+ foreignKeyName: "planningAction_purchaseOrderLineId_fkey"+ columns: ["purchaseOrderLineId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["id"]+ },{foreignKeyName: "planningAction_supplierId_fkey"columns: ["supplierId"]@@ -47383,6 +47404,13 @@ export type Database = {referencedRelation: "purchaseOrder"referencedColumns: ["id"]},+ {+ foreignKeyName: "purchaseInvoiceLines_purchaseOrderId_fkey"+ columns: ["purchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["purchaseOrderId"]+ },{foreignKeyName: "purchaseInvoiceLines_purchaseOrderId_fkey"columns: ["purchaseOrderId"]@@ -47418,6 +47446,13 @@ export type Database = {referencedRelation: "purchaseOrderLines"referencedColumns: ["id"]},+ {+ foreignKeyName: "purchaseInvoiceLines_purchaseOrderLineId_fkey"+ columns: ["purchaseOrderLineId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["id"]+ },{foreignKeyName: "purchaseInvoiceLines_purchaseUnitOfMeasureCode_fkey"columns: ["purchaseUnitOfMeasureCode", "companyId"]@@ -48039,6 +48074,13 @@ export type Database = {referencedRelation: "purchaseOrder"referencedColumns: ["id"]},+ {+ foreignKeyName: "purchaseOrderDelivery_id_fkey"+ columns: ["id"]+ isOneToOne: true+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["purchaseOrderId"]+ },{foreignKeyName: "purchaseOrderDelivery_id_fkey"columns: ["id"]@@ -48132,6 +48174,13 @@ export type Database = {referencedRelation: "purchaseOrder"referencedColumns: ["id"]},+ {+ foreignKeyName: "purchaseOrderFavorites_purchaseOrderId_fkey"+ columns: ["purchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["purchaseOrderId"]+ },{foreignKeyName: "purchaseOrderFavorites_purchaseOrderId_fkey"columns: ["purchaseOrderId"]@@ -48572,6 +48621,13 @@ export type Database = {referencedRelation: "purchaseOrder"referencedColumns: ["id"]},+ {+ foreignKeyName: "purchaseOrderLine_purchaseOrderId_fkey"+ columns: ["purchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["purchaseOrderId"]+ },{foreignKeyName: "purchaseOrderLine_purchaseOrderId_fkey"columns: ["purchaseOrderId"]@@ -48685,6 +48741,13 @@ export type Database = {referencedRelation: "purchaseOrder"referencedColumns: ["id"]},+ {+ foreignKeyName: "purchaseOrderPayment_id_fkey"+ columns: ["id"]+ isOneToOne: true+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["purchaseOrderId"]+ },{foreignKeyName: "purchaseOrderPayment_id_fkey"columns: ["id"]@@ -48814,6 +48877,13 @@ export type Database = {referencedRelation: "purchaseOrder"referencedColumns: ["id"]},+ {+ foreignKeyName: "purchaseOrderStatusHistory_purchaseOrderId_fkey"+ columns: ["purchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["purchaseOrderId"]+ },{foreignKeyName: "purchaseOrderStatusHistory_purchaseOrderId_fkey"columns: ["purchaseOrderId"]@@ -48898,6 +48968,13 @@ export type Database = {referencedRelation: "purchaseOrder"referencedColumns: ["id"]},+ {+ foreignKeyName: "purchaseOrderTransaction_purchaseOrderId_fkey"+ columns: ["purchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["purchaseOrderId"]+ },{foreignKeyName: "purchaseOrderTransaction_purchaseOrderId_fkey"columns: ["purchaseOrderId"]@@ -49138,6 +49215,13 @@ export type Database = {referencedRelation: "purchaseOrder"referencedColumns: ["id"]},+ {+ foreignKeyName: "purchaseReturnOrder_purchaseOrderId_fkey"+ columns: ["purchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["purchaseOrderId"]+ },{foreignKeyName: "purchaseReturnOrder_purchaseOrderId_fkey"columns: ["purchaseOrderId"]@@ -49159,6 +49243,13 @@ export type Database = {referencedRelation: "purchaseOrder"referencedColumns: ["id"]},+ {+ foreignKeyName: "purchaseReturnOrder_replacementPurchaseOrderId_fkey"+ columns: ["replacementPurchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["purchaseOrderId"]+ },{foreignKeyName: "purchaseReturnOrder_replacementPurchaseOrderId_fkey"columns: ["replacementPurchaseOrderId"]@@ -49622,6 +49713,13 @@ export type Database = {referencedRelation: "purchaseOrderLines"referencedColumns: ["id"]},+ {+ foreignKeyName: "purchaseReturnOrderLine_purchaseOrderLineId_fkey"+ columns: ["purchaseOrderLineId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["id"]+ },{foreignKeyName: "purchaseReturnOrderLine_purchaseReturnOrderId_fkey"columns: ["purchaseReturnOrderId", "companyId"]@@ -50586,6 +50684,13 @@ export type Database = {referencedRelation: "purchaseOrder"referencedColumns: ["id"]},+ {+ foreignKeyName: "purchasingRfqToPurchaseOrder_purchaseOrderId_fkey"+ columns: ["purchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["purchaseOrderId"]+ },{foreignKeyName: "purchasingRfqToPurchaseOrder_purchaseOrderId_fkey"columns: ["purchaseOrderId"]@@ -54463,6 +54568,13 @@ export type Database = {referencedRelation: "purchaseOrderLines"referencedColumns: ["id"]},+ {+ foreignKeyName: "receiptFixedAssetLine_purchaseOrderLineId_fkey"+ columns: ["purchaseOrderLineId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["id"]+ },{foreignKeyName: "receiptFixedAssetLine_receiptId_fkey"columns: ["receiptId"]@@ -81521,6 +81633,13 @@ export type Database = {referencedRelation: "purchaseOrder"referencedColumns: ["id"]},+ {+ foreignKeyName: "purchaseOrderLine_purchaseOrderId_fkey"+ columns: ["purchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["purchaseOrderId"]+ },{foreignKeyName: "purchaseOrderLine_purchaseOrderId_fkey"columns: ["purchaseOrderId"]@@ -82695,6 +82814,13 @@ export type Database = {referencedRelation: "purchaseOrder"referencedColumns: ["id"]},+ {+ foreignKeyName: "purchaseInvoiceLines_purchaseOrderId_fkey"+ columns: ["purchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["purchaseOrderId"]+ },{foreignKeyName: "purchaseInvoiceLines_purchaseOrderId_fkey"columns: ["purchaseOrderId"]@@ -82730,6 +82856,13 @@ export type Database = {referencedRelation: "purchaseOrderLines"referencedColumns: ["id"]},+ {+ foreignKeyName: "purchaseInvoiceLines_purchaseOrderLineId_fkey"+ columns: ["purchaseOrderLineId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["id"]+ },{foreignKeyName: "purchaseInvoiceLines_purchaseUnitOfMeasureCode_fkey"columns: ["purchaseUnitOfMeasureCode", "companyId"]@@ -83337,6 +83470,13 @@ export type Database = {referencedRelation: "purchaseOrder"referencedColumns: ["id"]},+ {+ foreignKeyName: "purchaseOrderLine_purchaseOrderId_fkey"+ columns: ["purchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["purchaseOrderId"]+ },{foreignKeyName: "purchaseOrderLine_purchaseOrderId_fkey"columns: ["purchaseOrderId"]@@ -83402,6 +83542,94 @@ export type Database = {}]}+ purchaseOrderLinesToReceive: {+ Row: {+ companyId: string | null+ description: string | null+ id: string | null+ itemId: string | null+ itemName: string | null+ itemReadableId: string | null+ itemType: Database["public"]["Enums"]["itemType"] | null+ locationId: string | null+ orderDate: string | null+ promisedDate: string | null+ purchaseOrderId: string | null+ purchaseOrderLineType:+ | Database["public"]["Enums"]["purchaseOrderLineType"]+ | null+ purchaseOrderReadableId: string | null+ purchaseOrderType:+ | Database["public"]["Enums"]["purchaseOrderType"]+ | null+ purchaseQuantity: number | null+ purchaseUnitOfMeasureCode: string | null+ quantityReceived: number | null+ quantityToReceive: number | null+ receivedComplete: boolean | null+ revisionId: number | null+ searchText: string | null+ sortOrder: number | null+ status: Database["public"]["Enums"]["purchaseOrderStatus"] | null+ supplierId: string | null+ supplierName: string | null+ supplierPartId: string | null+ supplierReference: string | null+ thumbnailPath: string | null+ trackingNumber: string | null+ }+ Relationships: [+ {+ foreignKeyName: "purchaseOrderLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "consumables"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchaseOrderLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "item"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchaseOrderLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "materials"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchaseOrderLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "parts"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchaseOrderLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "services"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchaseOrderLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "tools"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchaseOrderLine_purchaseUnitOfMeasureCode_fkey"+ columns: ["purchaseUnitOfMeasureCode", "companyId"]+ isOneToOne: false+ referencedRelation: "unitOfMeasure"+ referencedColumns: ["code", "companyId"]+ }+ ]+ }purchaseOrderLocations: {Row: {companyCountryCode: string | null@@ -83964,6 +84192,13 @@ export type Database = {referencedRelation: "purchaseOrder"referencedColumns: ["id"]},+ {+ foreignKeyName: "purchaseReturnOrder_purchaseOrderId_fkey"+ columns: ["purchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["purchaseOrderId"]+ },{foreignKeyName: "purchaseReturnOrder_purchaseOrderId_fkey"columns: ["purchaseOrderId"]@@ -83985,6 +84220,13 @@ export type Database = {referencedRelation: "purchaseOrder"referencedColumns: ["id"]},+ {+ foreignKeyName: "purchaseReturnOrder_replacementPurchaseOrderId_fkey"+ columns: ["replacementPurchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLinesToReceive"+ referencedColumns: ["purchaseOrderId"]+ },{foreignKeyName: "purchaseReturnOrder_replacementPurchaseOrderId_fkey"columns: ["replacementPurchaseOrderId"]diff --git a/packages/database/supabase/migrations/20261026134712_purchase-order-lines-to-receive.sql b/packages/database/supabase/migrations/20261026134712_purchase-order-lines-to-receive.sqlnew file mode 100644index 0000000000..b5aacaab15--- /dev/null+++ b/packages/database/supabase/migrations/20261026134712_purchase-order-lines-to-receive.sql@@ -0,0 +1,67 @@+-- The lines a receiving clerk can receive against: every item line of a purchase+-- order that is waiting to be received. Inventory → Receiving searches it by+-- whatever the packing slip carries, so "searchText" holds each searchable value+-- lower-cased with everything but letters and digits removed (RAB-514 and+-- RAB 514 both read rab514). The values are joined with "|", which a search+-- word never contains, so a match never spans two values.+CREATE OR REPLACE VIEW "purchaseOrderLinesToReceive" WITH(SECURITY_INVOKER=true) AS+SELECT+ pl."id",+ pl."companyId",+ po."id" AS "purchaseOrderId",+ po."purchaseOrderId" AS "purchaseOrderReadableId",+ po."revisionId",+ po."status",+ po."purchaseOrderType",+ po."orderDate",+ po."supplierId",+ s."name" AS "supplierName",+ po."supplierReference",+ pod."trackingNumber",+ COALESCE(pl."locationId", pod."locationId") AS "locationId",+ pl."purchaseOrderLineType",+ pl."itemId",+ i."readableIdWithRevision" AS "itemReadableId",+ i."name" AS "itemName",+ i."type" AS "itemType",+ COALESCE(i."thumbnailPath", mu."thumbnailPath") AS "thumbnailPath",+ pl."description",+ COALESCE(NULLIF(pl."supplierPartId", ''), sp."supplierPartId") AS "supplierPartId",+ pl."purchaseQuantity",+ pl."quantityReceived",+ pl."quantityToReceive",+ pl."purchaseUnitOfMeasureCode",+ pl."receivedComplete",+ COALESCE(pl."promisedDate", pod."receiptPromisedDate") AS "promisedDate",+ pl."sortOrder",+ concat_ws(+ '|',+ regexp_replace(lower(po."purchaseOrderId"), '[^[:alnum:]]+', '', 'g'),+ regexp_replace(lower(s."name"), '[^[:alnum:]]+', '', 'g'),+ regexp_replace(lower(po."supplierReference"), '[^[:alnum:]]+', '', 'g'),+ regexp_replace(lower(pod."trackingNumber"), '[^[:alnum:]]+', '', 'g'),+ regexp_replace(lower(po."jobReadableId"), '[^[:alnum:]]+', '', 'g'),+ regexp_replace(lower(i."readableIdWithRevision"), '[^[:alnum:]]+', '', 'g'),+ regexp_replace(lower(i."name"), '[^[:alnum:]]+', '', 'g'),+ regexp_replace(lower(pl."description"), '[^[:alnum:]]+', '', 'g'),+ regexp_replace(lower(pl."supplierPartId"), '[^[:alnum:]]+', '', 'g'),+ regexp_replace(lower(sp."supplierPartId"), '[^[:alnum:]]+', '', 'g')+ ) AS "searchText"+FROM "purchaseOrderLine" pl+INNER JOIN "purchaseOrder" po ON po."id" = pl."purchaseOrderId"+INNER JOIN "supplier" s ON s."id" = po."supplierId"+LEFT JOIN "purchaseOrderDelivery" pod ON pod."id" = po."id"+LEFT JOIN "item" i ON i."id" = pl."itemId"+LEFT JOIN "modelUpload" mu ON mu."id" = i."modelUploadId"+LEFT JOIN LATERAL (+ SELECT sp."supplierPartId"+ FROM "supplierPart" sp+ WHERE sp."supplierId" = po."supplierId"+ AND sp."itemId" = pl."itemId"+ AND sp."companyId" = pl."companyId"+ ORDER BY sp."id"+ LIMIT 1+) sp ON TRUE+WHERE po."status" IN ('To Receive', 'To Receive and Invoice')+ -- The line types a receipt is built from (receiptFromPurchaseOrder).+ AND pl."purchaseOrderLineType" IN ('Part', 'Material', 'Tool', 'Fixture', 'Consumable');diff --git a/packages/jobs/manifests/schema.json b/packages/jobs/manifests/schema.jsonindex c20edce6b9..cba7786dec 100644--- a/packages/jobs/manifests/schema.json+++ b/packages/jobs/manifests/schema.json@@ -1,11 +1,11 @@{"kind": "carbon-company-backup","version": 1,- "schemaVersion": "20261026114317",+ "schemaVersion": "20261026134712","sourceCompanyId": "schema-baseline","sourceCompanyGroupId": null,"sourceCompanyName": null,- "exportedAt": "2026-10-26T11:21:26.280Z",+ "exportedAt": "2026-10-26T20:21:00.335Z","exportedBy": "schema-baseline","label": "schema baseline","includeStorage": "none",diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.poindex 31383a0d5a..bac35a16d9 100644--- a/packages/locale/locales/de/erp.po+++ b/packages/locale/locales/de/erp.po@@ -2535,6 +2535,9 @@ msgstr "auch bei {otherStationNames}"msgid "Also notify"msgstr "Auch benachrichtigen"+msgid "Also open on {links}"+msgstr "Ebenfalls offen auf {links}"+msgid "Always"msgstr "Immer"@@ -6024,6 +6027,9 @@ msgstr "Eindeutige Kennung der Verfahrensanweisung kopieren"msgid "Copy purchase invoice unique identifier"msgstr "Eindeutige Kennung der Eingangsrechnung kopieren"+msgid "Copy purchase order number"+msgstr "Bestellnummer kopieren"+msgid "Copy purchase order unique identifier"msgstr "Bestellnummer kopieren"@@ -15095,6 +15101,9 @@ msgstr "Keine offenen Arbeitsgänge"msgid "No open orders for this item are available to link."msgstr "Für diesen Artikel sind keine offenen Bestellungen zum Verknüpfen verfügbar."+msgid "No open purchase order lines match your search. Every word must match; spaces and punctuation are ignored."+msgstr "Keine offenen Bestellpositionen entsprechen Ihrer Suche. Jedes Wort muss übereinstimmen; Leerzeichen und Satzzeichen werden ignoriert."+msgid "No open reimbursements"msgstr "Keine offenen Kostenerstattungen"@@ -15210,6 +15219,9 @@ msgstr "Für diesen Vorgang wurden noch keine Produktionsereignisse aufgezeichnemsgid "No production recorded yet."msgstr "Noch keine Produktion aufgezeichnet."+msgid "No purchase orders are waiting to be received."+msgstr "Keine Bestellungen warten auf Wareneingang."+msgid "No purchases in this period"msgstr "Keine Käufe in diesem Zeitraum"diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.poindex 418f43518c..bfb6703516 100644--- a/packages/locale/locales/en/erp.po+++ b/packages/locale/locales/en/erp.po@@ -2535,6 +2535,9 @@ msgstr "also at {otherStationNames}"msgid "Also notify"msgstr "Also notify"+msgid "Also open on {links}"+msgstr "Also open on {links}"+msgid "Always"msgstr "Always"@@ -6024,6 +6027,9 @@ msgstr "Copy procedure unique identifier"msgid "Copy purchase invoice unique identifier"msgstr "Copy purchase invoice unique identifier"+msgid "Copy purchase order number"+msgstr "Copy purchase order number"+msgid "Copy purchase order unique identifier"msgstr "Copy purchase order unique identifier"@@ -15095,6 +15101,9 @@ msgstr "No open operations"msgid "No open orders for this item are available to link."msgstr "No open orders for this item are available to link."+msgid "No open purchase order lines match your search. Every word must match; spaces and punctuation are ignored."+msgstr "No open purchase order lines match your search. Every word must match; spaces and punctuation are ignored."+msgid "No open reimbursements"msgstr "No open reimbursements"@@ -15210,6 +15219,9 @@ msgstr "No production events recorded for this operation yet"msgid "No production recorded yet."msgstr "No production recorded yet."+msgid "No purchase orders are waiting to be received."+msgstr "No purchase orders are waiting to be received."+msgid "No purchases in this period"msgstr "No purchases in this period"diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.poindex a0f6391a7b..cac352c0b6 100644--- a/packages/locale/locales/es/erp.po+++ b/packages/locale/locales/es/erp.po@@ -2535,6 +2535,9 @@ msgstr "también en {otherStationNames}"msgid "Also notify"msgstr "También notificar"+msgid "Also open on {links}"+msgstr "También abierto en {links}"+msgid "Always"msgstr "Siempre"@@ -6024,6 +6027,9 @@ msgstr "Copiar identificador único del procedimiento"msgid "Copy purchase invoice unique identifier"msgstr "Copiar identificador único de factura de compra"+msgid "Copy purchase order number"+msgstr "Copiar número de orden de compra"+msgid "Copy purchase order unique identifier"msgstr "Copiar identificador único de orden de compra"@@ -15095,6 +15101,9 @@ msgstr "Sin operaciones abiertas"msgid "No open orders for this item are available to link."msgstr "No hay pedidos abiertos disponibles para este artículo."+msgid "No open purchase order lines match your search. Every word must match; spaces and punctuation are ignored."+msgstr "Ninguna línea abierta de orden de compra coincide con su búsqueda. Cada palabra debe coincidir; los espacios y la puntuación se ignoran."+msgid "No open reimbursements"msgstr "Sin reembolsos abiertos"@@ -15210,6 +15219,9 @@ msgstr "Aún no se han registrado eventos de producción para esta operación"msgid "No production recorded yet."msgstr "Sin producción registrada aún."+msgid "No purchase orders are waiting to be received."+msgstr "No hay órdenes de compra esperando a ser recibidas."+msgid "No purchases in this period"msgstr "Sin compras en este período"diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.poindex a4c657b252..a9246f86ce 100644--- a/packages/locale/locales/fr/erp.po+++ b/packages/locale/locales/fr/erp.po@@ -2535,6 +2535,9 @@ msgstr "aussi à {otherStationNames}"msgid "Also notify"msgstr "Notifier aussi"+msgid "Also open on {links}"+msgstr "Également ouvert sur {links}"+msgid "Always"msgstr "Toujours"@@ -6024,6 +6027,9 @@ msgstr "Copier l'identifiant unique de la procédure"msgid "Copy purchase invoice unique identifier"msgstr "Copier l'identifiant unique de la facture d'achat"+msgid "Copy purchase order number"+msgstr "Copier le numéro du bon de commande"+msgid "Copy purchase order unique identifier"msgstr "Copier l'identifiant unique du bon de commande"@@ -15095,6 +15101,9 @@ msgstr "Aucune opération ouverte"msgid "No open orders for this item are available to link."msgstr "Aucune commande ouverte pour cet article n'est disponible pour la liaison."+msgid "No open purchase order lines match your search. Every word must match; spaces and punctuation are ignored."+msgstr "Aucune ligne de bon de commande ouverte ne correspond à votre recherche. Chaque mot doit correspondre ; les espaces et la ponctuation sont ignorés."+msgid "No open reimbursements"msgstr "Aucun remboursement ouvert"@@ -15210,6 +15219,9 @@ msgstr "Aucun événement de production n'a encore été enregistré pour cettemsgid "No production recorded yet."msgstr "Aucune production enregistrée pour le moment."+msgid "No purchase orders are waiting to be received."+msgstr "Aucun bon de commande n'attend d'être reçu."+msgid "No purchases in this period"msgstr "Aucun achat dans cette période"diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.poindex 5b83b1bed1..c5721a00b7 100644--- a/packages/locale/locales/hi/erp.po+++ b/packages/locale/locales/hi/erp.po@@ -2535,6 +2535,9 @@ msgstr "यह भी {otherStationNames} पर"msgid "Also notify"msgstr "साथ ही सूचित करें"+msgid "Also open on {links}"+msgstr "{links} पर भी खुला है"+msgid "Always"msgstr "हमेशा"@@ -6024,6 +6027,9 @@ msgstr "कार्यविधि की अद्वितीय पहचाmsgid "Copy purchase invoice unique identifier"msgstr "क्रय चालान की विशिष्ट पहचान नकल करें"+msgid "Copy purchase order number"+msgstr "क्रय आदेश संख्या कॉपी करें"+msgid "Copy purchase order unique identifier"msgstr "क्रय आदेश की विशिष्ट पहचान नकल करें"@@ -15095,6 +15101,9 @@ msgstr "कोई खुला ऑपरेशन नहीं"msgid "No open orders for this item are available to link."msgstr "इस आइटम के लिए लिंक करने के लिए कोई खुले ऑर्डर उपलब्ध नहीं हैं।"+msgid "No open purchase order lines match your search. Every word must match; spaces and punctuation are ignored."+msgstr "कोई खुली क्रय आदेश पंक्तियाँ आपकी खोज से मेल नहीं खाती हैं। खोज में सभी शब्दों का मेल खाना चाहिए; रिक्त स्थान और विराम चिह्न को अनदेखा किया जाता है।"+msgid "No open reimbursements"msgstr "कोई खुली प्रतिपूर्ति नहीं"@@ -15210,6 +15219,9 @@ msgstr "इस ऑपरेशन के लिए अभी तक कोईmsgid "No production recorded yet."msgstr "अभी तक कोई उत्पादन दर्ज नहीं किया गया।"+msgid "No purchase orders are waiting to be received."+msgstr "कोई भी क्रय आदेश प्राप्ति की प्रतीक्षा में नहीं है।"+msgid "No purchases in this period"msgstr "इस अवधि में कोई खरीद नहीं"diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.poindex 8262642982..1687b8eb90 100644--- a/packages/locale/locales/it/erp.po+++ b/packages/locale/locales/it/erp.po@@ -2535,6 +2535,9 @@ msgstr "anche presso {otherStationNames}"msgid "Also notify"msgstr "Notifica inoltre"+msgid "Also open on {links}"+msgstr "Anche aperto su {links}"+msgid "Always"msgstr "Sempre"@@ -6024,6 +6027,9 @@ msgstr "Copia identificatore univoco della procedura"msgid "Copy purchase invoice unique identifier"msgstr "Copia identificatore univoco fattura di acquisto"+msgid "Copy purchase order number"+msgstr "Copia numero ordine di acquisto"+msgid "Copy purchase order unique identifier"msgstr "Copia identificatore univoco ordine di acquisto"@@ -15095,6 +15101,9 @@ msgstr "Nessuna operazione aperta"msgid "No open orders for this item are available to link."msgstr "Nessun ordine aperto per questo articolo disponibile per il collegamento."+msgid "No open purchase order lines match your search. Every word must match; spaces and punctuation are ignored."+msgstr "Nessuna riga dell'ordine di acquisto aperta corrisponde alla ricerca. Ogni parola deve corrispondere; gli spazi e la punteggiatura sono ignorati."+msgid "No open reimbursements"msgstr "Nessun rimborso aperto"@@ -15210,6 +15219,9 @@ msgstr "Nessun evento di produzione ancora registrato per questa operazione"msgid "No production recorded yet."msgstr "Nessuna produzione registrata ancora."+msgid "No purchase orders are waiting to be received."+msgstr "Nessun ordine di acquisto è in attesa di essere ricevuto."+msgid "No purchases in this period"msgstr "Nessun acquisto in questo periodo"diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.poindex b4ba2bad41..7b8efb4693 100644--- a/packages/locale/locales/ja/erp.po+++ b/packages/locale/locales/ja/erp.po@@ -2535,6 +2535,9 @@ msgstr "{otherStationNames}でも実施中"msgid "Also notify"msgstr "また通知する"+msgid "Also open on {links}"+msgstr "他のオープン発注書:{links}"+msgid "Always"msgstr "常に"@@ -6024,6 +6027,9 @@ msgstr "手順書の識別子をコピー"msgid "Copy purchase invoice unique identifier"msgstr "仕入先請求書の一意識別子をコピー"+msgid "Copy purchase order number"+msgstr "発注書番号をコピー"+msgid "Copy purchase order unique identifier"msgstr "発注書の一意識別子をコピー"@@ -15095,6 +15101,9 @@ msgstr "オープン状態の工程がありません"msgid "No open orders for this item are available to link."msgstr "この品目のオープン注文はリンク可能なものがありません。"+msgid "No open purchase order lines match your search. Every word must match; spaces and punctuation are ignored."+msgstr "検索に一致するオープン発注書明細がありません。すべての単語が一致する必要があります。スペースと句読点は無視されます。"+msgid "No open reimbursements"msgstr "オープンな払戻がありません"@@ -15210,6 +15219,9 @@ msgstr "この操作で記録された生産イベントはまだありませんmsgid "No production recorded yet."msgstr "生産がまだ記録されていません。"+msgid "No purchase orders are waiting to be received."+msgstr "受け取り待ちの発注書はありません。"+msgid "No purchases in this period"msgstr "この期間に購入がありません"diff --git a/packages/locale/locales/ko/erp.po b/packages/locale/locales/ko/erp.poindex d101745e4a..da2335de4d 100644--- a/packages/locale/locales/ko/erp.po+++ b/packages/locale/locales/ko/erp.po@@ -2535,6 +2535,9 @@ msgstr "{otherStationNames}에서도"msgid "Also notify"msgstr "또한 알림"+msgid "Also open on {links}"+msgstr "다른 미결 발주서: {links}"+msgid "Always"msgstr "항상"@@ -6024,6 +6027,9 @@ msgstr "절차서 고유 식별자 복사"msgid "Copy purchase invoice unique identifier"msgstr "매입 송장 고유 식별자 복사"+msgid "Copy purchase order number"+msgstr "발주서 번호 복사"+msgid "Copy purchase order unique identifier"msgstr "발주서 고유 식별자 복사"@@ -15095,6 +15101,9 @@ msgstr "미결 공정 없음"msgid "No open orders for this item are available to link."msgstr "이 품목에 연결할 수 있는 미결 발주서가 없습니다."+msgid "No open purchase order lines match your search. Every word must match; spaces and punctuation are ignored."+msgstr "검색과 일치하는 미결 발주서 라인이 없습니다. 모든 단어가 일치해야 하며 공백과 구두점은 무시됩니다."+msgid "No open reimbursements"msgstr "미결 환급금 없음"@@ -15210,6 +15219,9 @@ msgstr "이 공정작업에 대해 아직 기록된 생산 이벤트가 없습msgid "No production recorded yet."msgstr "아직 기록된 생산이 없습니다."+msgid "No purchase orders are waiting to be received."+msgstr "수령 대기 중인 발주서가 없습니다."+msgid "No purchases in this period"msgstr "이 기간에 구매가 없습니다"diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.poindex c81daebd19..4319682c2b 100644--- a/packages/locale/locales/pl/erp.po+++ b/packages/locale/locales/pl/erp.po@@ -2535,6 +2535,9 @@ msgstr "także w {otherStationNames}"msgid "Also notify"msgstr "Poinformuj również"+msgid "Also open on {links}"+msgstr "Także otwarty na {links}"+msgid "Always"msgstr "Zawsze"@@ -6024,6 +6027,9 @@ msgstr "Skopiuj unikatowy identyfikator procedury"msgid "Copy purchase invoice unique identifier"msgstr "Skopiuj unikalny identyfikator faktury zakupu"+msgid "Copy purchase order number"+msgstr "Skopiuj numer zamówienia zakupu"+msgid "Copy purchase order unique identifier"msgstr "Skopiuj unikalny identyfikator zamówienia zakupu"@@ -15095,6 +15101,9 @@ msgstr "Brak otwartych operacji"msgid "No open orders for this item are available to link."msgstr "Brak dostępnych otwartych zamówień dla tego produktu do powiązania."+msgid "No open purchase order lines match your search. Every word must match; spaces and punctuation are ignored."+msgstr "Nie znaleziono otwartych pozycji zamówienia zakupu odpowiadających wyszukiwaniu. Każde słowo musi się zgadzać; spacje i znaki interpunkcyjne są ignorowane."+msgid "No open reimbursements"msgstr "Brak otwartych zwrotów kosztów"@@ -15210,6 +15219,9 @@ msgstr "Brak zarejestrowanych zdarzeń produkcyjnych dla tej operacji"msgid "No production recorded yet."msgstr "Brak zarejestrowanej produkcji."+msgid "No purchase orders are waiting to be received."+msgstr "Brak zamówień zakupu oczekujących na przyjęcie."+msgid "No purchases in this period"msgstr "Brak zakupów w tym okresie"diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.poindex 8f8096b036..482cb004de 100644--- a/packages/locale/locales/pt/erp.po+++ b/packages/locale/locales/pt/erp.po@@ -2535,6 +2535,9 @@ msgstr "também em {otherStationNames}"msgid "Also notify"msgstr "Também notificar"+msgid "Also open on {links}"+msgstr "Também aberto em {links}"+msgid "Always"msgstr "Sempre"@@ -6024,6 +6027,9 @@ msgstr "Copiar identificador único do procedimento"msgid "Copy purchase invoice unique identifier"msgstr "Copiar identificador único da fatura de compra"+msgid "Copy purchase order number"+msgstr "Copiar número do pedido de compra"+msgid "Copy purchase order unique identifier"msgstr "Copiar identificador único do pedido de compra"@@ -15095,6 +15101,9 @@ msgstr "Nenhuma operação aberta"msgid "No open orders for this item are available to link."msgstr "Nenhum pedido aberto para este item está disponível para vincular."+msgid "No open purchase order lines match your search. Every word must match; spaces and punctuation are ignored."+msgstr "Nenhuma linha de pedido de compra aberta corresponde à sua pesquisa. Cada palavra deve corresponder; espaços e pontuação são ignorados."+msgid "No open reimbursements"msgstr "Nenhum reembolso em aberto"@@ -15210,6 +15219,9 @@ msgstr "Ainda não há eventos de produção registados para esta operação"msgid "No production recorded yet."msgstr "Nenhuma produção registrada ainda."+msgid "No purchase orders are waiting to be received."+msgstr "Nenhum pedido de compra aguardando recebimento."+msgid "No purchases in this period"msgstr "Nenhuma compra neste período"diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.poindex f1fc8ad866..32128d05b6 100644--- a/packages/locale/locales/ru/erp.po+++ b/packages/locale/locales/ru/erp.po@@ -2535,6 +2535,9 @@ msgstr "также на {otherStationNames}"msgid "Also notify"msgstr "Также уведомить"+msgid "Also open on {links}"+msgstr "Также открыто на {links}"+msgid "Always"msgstr "Всегда"@@ -6024,6 +6027,9 @@ msgstr "Скопировать уникальный идентификаторmsgid "Copy purchase invoice unique identifier"msgstr "Скопировать уникальный идентификатор счета-фактуры полученного"+msgid "Copy purchase order number"+msgstr "Копировать номер заказа поставщику"+msgid "Copy purchase order unique identifier"msgstr "Скопировать уникальный идентификатор заказа поставщику"@@ -15095,6 +15101,9 @@ msgstr "Нет открытых операций"msgid "No open orders for this item are available to link."msgstr "Нет открытых заказов для этого товара, доступных для связи."+msgid "No open purchase order lines match your search. Every word must match; spaces and punctuation are ignored."+msgstr "Нет открытых строк заказа поставщику, соответствующих вашему поиску. Каждое слово должно совпадать; пробелы и пунктуация игнорируются."+msgid "No open reimbursements"msgstr "Нет открытых возмещений"@@ -15210,6 +15219,9 @@ msgstr "Для этой операции еще не записано ни одmsgid "No production recorded yet."msgstr "Производство еще не записано."+msgid "No purchase orders are waiting to be received."+msgstr "Нет заказов поставщику, ожидающих приемки."+msgid "No purchases in this period"msgstr "Нет покупок в этом периоде"diff --git a/packages/locale/locales/tr/erp.po b/packages/locale/locales/tr/erp.poindex ac2722b513..3afa7b04c2 100644--- a/packages/locale/locales/tr/erp.po+++ b/packages/locale/locales/tr/erp.po@@ -2535,6 +2535,9 @@ msgstr "ayrıca {otherStationNames} adresinde"msgid "Also notify"msgstr "Ayrıca bildir"+msgid "Also open on {links}"+msgstr "{links} üzerinde de açık"+msgid "Always"msgstr "Her zaman"@@ -6024,6 +6027,9 @@ msgstr "Prosedürün benzersiz tanımlayıcısını kopyala"msgid "Copy purchase invoice unique identifier"msgstr "Alış faturası benzersiz tanıtıcısını kopyala"+msgid "Copy purchase order number"+msgstr "Satın alma siparişi numarasını kopyala"+msgid "Copy purchase order unique identifier"msgstr "Satın alma siparişi benzersiz tanıtıcısını kopyala"@@ -15095,6 +15101,9 @@ msgstr "Açık operasyon yok"msgid "No open orders for this item are available to link."msgstr "Bu Stok kartı için bağlantı kurmak amacıyla Açık siparişler bulunmamaktadır."+msgid "No open purchase order lines match your search. Every word must match; spaces and punctuation are ignored."+msgstr "Aramanızla eşleşen açık satın alma siparişi satırı yok. Her sözcük eşleşmelidir; boşluklar ve noktalama işaretleri dikkate alınmaz."+msgid "No open reimbursements"msgstr "Açık Gider Talebileri Yok"@@ -15210,6 +15219,9 @@ msgstr "Bu operasyon için henüz kaydedilmiş üretim olayı yok"msgid "No production recorded yet."msgstr "Henüz kayıtlı üretim yok."+msgid "No purchase orders are waiting to be received."+msgstr "Alınması beklenen satın alma siparişi yok."+msgid "No purchases in this period"msgstr "Bu dönemde satın alma yok"diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.poindex 479c4e456a..2071de6849 100644--- a/packages/locale/locales/zh/erp.po+++ b/packages/locale/locales/zh/erp.po@@ -2535,6 +2535,9 @@ msgstr "也在 {otherStationNames}"msgid "Also notify"msgstr "同时通知"+msgid "Also open on {links}"+msgstr "其他未结采购订单:{links}"+msgid "Always"msgstr "始终"@@ -6024,6 +6027,9 @@ msgstr "复制程序文件唯一标识符"msgid "Copy purchase invoice unique identifier"msgstr "复制采购发票唯一标识符"+msgid "Copy purchase order number"+msgstr "复制采购订单编号"+msgid "Copy purchase order unique identifier"msgstr "复制采购订单唯一标识符"@@ -15095,6 +15101,9 @@ msgstr "没有未结工序"msgid "No open orders for this item are available to link."msgstr "此物料没有未结订单可供链接。"+msgid "No open purchase order lines match your search. Every word must match; spaces and punctuation are ignored."+msgstr "没有未结采购订单行符合您的搜索。每个词都必须完全匹配;空格和标点符号被忽略。"+msgid "No open reimbursements"msgstr "没有未结报销单"@@ -15210,6 +15219,9 @@ msgstr "此操作尚未记录任何生产事件"msgid "No production recorded yet."msgstr "还没有生产记录。"+msgid "No purchase orders are waiting to be received."+msgstr "没有采购订单等待接收。"+msgid "No purchases in this period"msgstr "此期间无采购"