PurchaseOrder
object type
A purchase order: an org orders variants x quantities x receiving LFs from ONE enabled vendor (the OrgVendor enablement — immutable at birth). Lines live in their OWN rows since and stay draft-editable wholesale; currency is the OrgVendor purchasingCurrency snapshot; received/closed_short are immutable non-doomed history; cancelled is the ONE doomed terminal (lists filter it). Re-running the same verb resumes a stalled walk; on a healthy in-flight order it refuses CONFLICT/IN_PROGRESS naming the progress.
Fields
| Field | Type | Notes |
|---|---|---|
id | ID ID! | The record’s id — a UUID the platform assigned when the record was created; every reference to this record uses it. |
sysId | String String! | The human-readable id, shaped like PO-… — stable for the record’s life. |
type | String String! | The kind of record — always PurchaseOrder here. |
caption | String String! | The record’s display name — what people see it called. |
status | String String! | The record’s current state — one of draft, pending_approval, issued, acknowledged, partially_received, issuing, cancelling, closing, received, closed_short or cancelled. |
parentId | ID ID! | The parent buying Organization; for a PurchaseOrder parentId!== rootId. |
rootId | ID ID! | The id of your organization group — every record of yours carries the same one. |
createdAt | String String! | When the record was created, as a UTC timestamp. |
updatedAt | String String! | When the record last changed, as a UTC timestamp. |
revisionNum | Int Int! | How many times this record has been edited; the first save is 0. |
revision | ID ID! | The id of the record’s current edit — send it back with a change so an edit made in the meantime is refused instead of overwritten. |
refCaptions | RefCaption [RefCaption!]! | The captions of the records this one refers to, composed for you — one row per referenced id; see RefCaption. |
orgVendorId | ID ID! | The supplying OrgVendor enablement — immutable at birth (re-vendor = cancel + new); active-gated at create AND re-checked at issue. |
currency | String String! | The PO currency — a snapshot of the OrgVendor purchasingCurrency at create. Every Money on the family (line costs, landed components, invoice amounts, credits) must match it; the rate framework is the named FX trigger. |
paymentTerms | String | Optional canned payment terms — snapshot defaulted from the OrgVendor at create, per-PO overridable. |
incotermCode | String | Optional canned Incoterms 2020 rule — snapshot defaulted from the OrgVendor at create, per-PO overridable. |
vendorReference | String | Optional vendor-side order/quote reference (their token — a bounded free string, max 64). |
notes | String | Optional free-text notes (max 4096). |
lineCount | Int Int! | Rollup: the live line rows on this order (0..1000) — maintained in the same transaction as every line mutation. Always <= nextLineNo - 1: removed numbers are never reused. |
openLineCount | Int Int! | Rollup: the lines still outstanding (receivedQty < quantity). |
nextLineNo | Int Int! | The monotonic next lineNo this order will assign (born 1; +1 per minted line; a removed number is never reused, so the poLineNo addressing on Receipt + VendorInvoice stays unambiguous forever). Ceiling 1000 + 1 = the assignment exhausted. |
merchandiseTotal | MoneyEntry MoneyEntry! | Rollup: sigma (quantity x unitCost) over the live lines, in the PO snapshot currency — the vendor orderMinimum gate at issue reads this instead of summing lines. Landed components are NOT in it (they join at receipt post). |
receivingReceiptId | ID | the ONE receipt mid-post against this order: set by a posting receipt’s first in-flight chunk, cleared by its last (the same transaction). A second receipt’s post refuses CONFLICT/IN_PROGRESS naming it, and close_short waits on it (policy:no_receipt_in_flight). Null when no receipt is walking. |
lines | PurchaseOrderLine [PurchaseOrderLine!]! | The whole line set, read from the line rows in lineNo order and bounded by the 1000-line ceiling. To page, filter or sort them — or to read a big order without hydrating every line — use the purchaseOrderLines query. |
walk | PurchaseOrderWalk | The in-flight on-order walk: present exactly while status is issuing / cancelling / closing — a large order whose stock stamps did not fit ONE transaction is written a chunk at a time, and this carries where it stands (kind · cursor = the next line to stamp, so cursor − 1 of lineCount landed · chunks so far · lineCount · startedAt · the machine executionArn once started · stalledAt + problem when a step failed past its retries). Null on every other status; cleared by the last chunk in the same transaction that lands the terminal. Re-run the same verb (issue / approve / cancel / close_short) to resume a stalled walk; on a healthy one it refuses CONFLICT/IN_PROGRESS naming the progress. |