Skip to main content
Version: v1.0.0(int)

W141: Delete receipt

Removes a WO receipt and the inventory effect it booked on both ledgers. Triggered from Work Order Detail receipts section.

Steps​

  1. Load the receipt. Call WorkOrders.getReceiptById and capture the workOrderId.

  2. Physically delete the receipt's ledger rows. Gather the receipt-item ids and call deleteBySource('wo_receipt', receiptItemIds) on both ledgers, removing the paired CONSUME and PRODUCE rows outright. This is a hard delete — the rows are gone, not offset with REVERSE_* rows. Gathering happens before the receipt items cascade away.

  3. Delete the receipt row. Call WorkOrders.deleteReceipt. Receipt items cascade away at the DB layer.

  4. Recompute the WO status. Recompute Partial / Received from the surviving receipts, reverting to Production when no received quantity remains, so the WO never dangles as Received/Partial without receipts.

Returns​

Nothing.

Business rules​

  • Hard delete, not reversal. The receipt never happened, so its ledger rows are removed rather than reversed. Cancellation is the append-only path that preserves history.
  • Atomic. Steps 2 through 4 share a single transaction.
  • Status follows the surviving receipts. Deleting the last receipt returns the WO to Production.

Errors​

  • NotFoundError. The receipt was not found.