Skip to content

DOM-COM-ORD-006Purchase Order

Markdown

DOM-COM-ORD-006

Purchase Order

Markdown
  • DocumentDraft
  • ImplementationObserved

Planning

Specified by
CON-COM-ORD-006

Design

Owned by
SVC-COM-ORD-purchasing

KindDomain objectProduct areaCommerceModuleCustomer purchases, purchased benefits and vendor stockRevision1

Read atservices-commerce c8b66a98

Relationships

ToCardinalityOwnershipCrosses a serviceOn archive or delete
DOM-COM-ORD-002Incoming stock can satisfy customer backorders and later shipments consume acquisition value.Inventory and shipping own physical allocation and delivery while Purchasing owns acquisition cost.no
DOM-COM-ORD-005Returned goods can reverse the acquisition cost consumed at shipment.The return reporter supplies the receipt and Purchasing persists restoration with it.no
DOM-ACC-BKS-001Each costing choice and posting fact identifies an Accounting business unit.Accounting retains business-unit and posted-journal ownership.yes

Invariants

InvariantProtectsEnforced atProvenance
INV-DOM-COM-ORD-006-01
Reusing a receipt key returns the recorded receipt without repeating its stock movement.
database, servicetest
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#answers the retried receipt as found under its key, writing nothing twice
INV-DOM-COM-ORD-006-02
Receiving requires an eligible order and quantities no greater than each line's unreceived remainder.
servicetest
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#refuses a receipt beyond what the line has open (over_receipt) and a receipt against a received order, writing nothing
INV-DOM-COM-ORD-006-03
Receipt movements, acquisition layers, posting facts, received quantities and backorder allocation share one commit.
service, databasetest
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#writes, in the receipt’s transaction, the receipt movement naming the line, the layer of 60 @ 1000 and the capitalize_receipt fact of 60000
INV-DOM-COM-ORD-006-04
Remaining layer units cannot be negative or exceed the layer quantity, and receipt layers require their receipt-line reference.
databaseobserved
services-commerce:modules/purchasing/db/inventory-cost-layers.table.ts:inventory_cost_layers_remaining_check, inventory_cost_layers_receipt_line_check
INV-DOM-COM-ORD-006-05
Each relief or restoration total is its unit cost multiplied by its quantity.
databaseobserved
INV-DOM-COM-ORD-006-06
A source movement has one fact per posting kind; repeating the posted stamp must retain the same Accounting reference.
database, servicetest
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#lists the unposted facts by date, stamps them posted once under Accounting’s reference, and refuses another reference on a posted fact
INV-DOM-COM-ORD-006-07
A costing-method change governs future work without revising existing layers or relief rows.
servicetest
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#rewrites nothing made before the switch: the FIFO relief rows read back unchanged, the receipt layers still record fifo
INV-DOM-COM-ORD-006-08
A referenced vendor cannot be removed while a purchase order or receipt uses it.
database, servicetest
services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#refuses a receipt against the received order 409, a receipt line with no quantity 400, and the vendor’s delete 409
INV-DOM-COM-ORD-006-09
Replacing a purchase order requires draft status and the version previously read.
servicetest
services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#replaces the draft at the version read with the record exactly as it was read, read-only line columns included, and answers the same lines one version on
INV-DOM-COM-ORD-006-10
Closed and cancelled purchase orders require their corresponding timestamps, which are absent in other statuses.
databaseobserved
services-commerce:modules/purchasing/db/purchase-orders.table.ts:purchase_orders_closed_check, purchase_orders_cancelled_check

The Markdown files under specs/ in rhythmsoftware/rhythm-v2-docs are the canonical source of truth. This reader is a generated, read-only projection of them.