---
id: JNY-COM-ORD-006
title: Vendor stock arrives through partial receipts
feature: FEAT-COM-ORD-07
product_area: commerce
module: orders
revision: 1
status: draft
product_intent: proposed
implementation_evidence: observed
supersedes:
  - COM-ACC-0473
  - COM-ACC-0460
  - COM-ACC-0474
  - COM-ACC-0478
source_sha:
  services-commerce: c8b66a98e2490617aec38ba5c8165dd9bd0a8f9b
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
actor: ACT-COM-019
goal: 'Acquire stock from a vendor, record each delivery at its landed cost and resolve the purchasing remainder.'
capabilities:
  - CAP-COM-ORD-017
  - CAP-COM-ORD-018
screens: []
steps:
  - 'n': 1
    surface: createVendor
    action: Create the Acme Supply vendor.
    capability: CAP-COM-ORD-017
    expected: The stored supplier email uses lower-case spelling.
    provenance: test
    source: >-
      services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#creates the vendor with its e-mail
      address lowercased, reads and lists it, replaces it at the version read (a stale one 409)
  - 'n': 2
    surface: issuePurchaseOrder
    action: Prepare and issue a purchase order for one hundred tote bags.
    capability: CAP-COM-ORD-017
    expected: The numbered purchasing document has issued status.
    provenance: test
    source: >-
      services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#drafts the order numbered with its
      line and issues it
  - 'n': 3
    surface: recordInventoryReceipt
    action: Record the first sixty units arriving.
    capability: CAP-COM-ORD-018
    expected: >-
      The receipt creates a layer at the purchasing cost, fills waiting backorders and leaves a partially
      received document.
    provenance: test
    source: >-
      services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#records the first receipt (10 at
      the order line’s cost), fills the two backorders in its transaction, and the order is partially received
  - 'n': 4
    surface: recordInventoryReceipt
    action: 'Record the remaining units with a revised cost, a reason and freight.'
    capability: CAP-COM-ORD-018
    expected: A second acquisition layer includes allocated freight and receipt progress reaches received.
    provenance: test
    source: >-
      services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#records the second receipt at 1200
      with its reason and 50 of landed cost per unit, and the order is received
  - 'n': 5
    surface: readInventoryValuation
    action: Review the inventory valuation.
    capability: CAP-COM-ORD-018
    expected: Layer value is compared with the quantity on hand and reconciliation explains the result.
    provenance: test
    source: >-
      services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#values the shirt L item at Σ the
      layers (3 at zero from the movement route, 10 × 1000, 10 × 1250 = 22500), reconciled with 23 on hand
  - 'n': 6
    surface: stampInventoryPostingsPosted
    action: Process the receipt facts through Accounting.
    capability: CAP-COM-ORD-018
    expected: 'Successful postings mark the facts posted, leaving no unposted receipt facts.'
    provenance: test
    source: >-
      services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#lists the facts unposted (the two
      receipts’), stamps them posted under Accounting’s reference, and lists none unposted after
alternates:
  - from_step: 4
    condition: Ten ordered units will not arrive
    path: Close the partially received purchase order
    outcome: The outstanding ten are cancelled and the document is closed
    provenance: test
    source: >-
      services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#closes
      an issued order after 90 of 100: cancelled_quantity 10, status closed; cancelling it instead is refused
failures:
  - from_step: 4
    condition: The delivery exceeds the outstanding quantity
    path: Refuse the receipt before applying its writes
    outcome: No receipt or related records are created
    provenance: test
    source: >-
      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
rules_in_play:
  - BR-CAP-COM-ORD-017-01
  - BR-CAP-COM-ORD-017-03
  - BR-CAP-COM-ORD-017-04
  - BR-CAP-COM-ORD-018-01
  - BR-CAP-COM-ORD-018-02
  - BR-CAP-COM-ORD-018-03
  - BR-CAP-COM-ORD-018-04
  - BR-CAP-COM-ORD-018-10
  - BR-CAP-COM-ORD-018-11
assertions:
  - id: AS-JNY-COM-ORD-006-01
    statement: The initial receipt satisfies waiting backorders in oldest-first order.
    provenance: test
    source: >-
      services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#fills
      the two backorders at the first receipt, oldest first, converting them to committed; the shelf shows 58
      available after
  - id: AS-JNY-COM-ORD-006-02
    statement: The valuation totals the acquisition layers and compares their quantity with stock on hand.
    provenance: test
    source: >-
      services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#values
      the item after at 30 × 1200 = 36000, reconciled with the ledger’s on-hand of 30
  - id: AS-JNY-COM-ORD-006-03
    statement: Each receipt posting fact is posted once.
    provenance: test
    source: >-
      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
e2e_policy: none
e2e_reason: >-
  The implemented purchasing journey is through the API; the pinned console provides no vendor, purchase-order
  or valuation screens.
evidence:
  - >-
    Examined reference: services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#creates the
    vendor with its e-mail address lowercased, reads and lists it, replaces it at the version read (a stale
    one 409)
  - >-
    Examined reference: services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#drafts the order
    numbered with its line and issues it
  - >-
    Examined reference: services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#lists the facts
    unposted (the two receipts’), stamps them posted under Accounting’s reference, and lists none unposted
    after
  - >-
    Examined reference: services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#records the
    first receipt (10 at the order line’s cost), fills the two backorders in its transaction, and the order is
    partially received
  - >-
    Examined reference: services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#records the
    second receipt at 1200 with its reason and 50 of landed cost per unit, and the order is received
  - >-
    Examined reference: services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#values the shirt
    L item at Σ the layers (3 at zero from the movement route, 10 × 1000, 10 × 1250 = 22500), reconciled with
    23 on hand
  - >-
    Examined reference:
    services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#closes
    an issued order after 90 of 100: cancelled_quantity 10, status closed; cancelling it instead is refused
  - >-
    Examined reference:
    services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#fills
    the two backorders at the first receipt, oldest first, converting them to committed; the shelf shows 58
    available after
  - >-
    Examined reference:
    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
  - >-
    Examined reference:
    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
  - >-
    Examined reference:
    services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#values
    the item after at 30 × 1200 = 36000, reconciled with the ledger’s on-hand of 30
---
# Vendor stock arrives through partial receipts

## Story

A buyer issues a vendor order for tote bags. Stock arrives in separate deliveries, each recorded with the cost that applies to it. Receipts satisfy waiting customer demand and establish acquisition layers. The buyer reviews the remaining commitment and valuation while Accounting receives the corresponding posting facts.
