Void Item Purchase
Reverse a purchase that should never have been recorded — append-only.
The existing undo paths could not express this. cancel_po_group_remainder only shrinks a PO down to what actually arrived (it explicitly leaves a fully-received item untouched), and delete_material_item erases the line outright, taking its receiving history with it. Neither can say "these units were logged in, and they were never really ours" — a mis-scanned receipt, a delivery credited to the wrong line, a purchase reversed by the vendor — while keeping the record that it happened.
NOTHING IS MUTATED IN PLACE. The reversal is a negative receiving_log line and an offsetting qc_log entry appended after the originals, so the dock receipt and the inspection that followed it both still read exactly as they were logged. An auditor sees a receipt and its reversal, not a gap.
The item lands back in the same state cancel_po_group_remainder reverts an unreceived line to — qs_state 'sel' with the PO number cleared — because 'cancelled' is not in the qs_state CHECK constraint and inventing it here would fail at the DB.
CLEARS status AND actual_received_date TOO. material_received_qty (the rule the scheduler gates on) falls back to "fully received" whenever the log nets to zero but status is RECEIVED, qs_state is 'purch', or a received date sits on the row. Zeroing only the log would leave every linked task still scheduled against material the shop no longer has, which is the entire point of voiding.
Body: { reason: str (required), force?: bool }
Request
- Base URL: https://api.jeevyfabrication.com (the document declares no server; this is the origin it was published from)
- URL: https://api.jeevyfabrication.com/api/v1/materials/items/{item_id}/void-purchase
- Auth: none declared
Path parameters
Request body
Response
Successful Response
Changes
No recorded changes to this operation across all 1 revision of this API.