Update PO Line
PATCH/api/purchase-order-lines/:purchase_order_line
Update a single purchase order line. Designed for the PO grid's inline-edit interactions (tax rate, quantity, unit cost, discount, description, FOC toggle, nominal code).
Authentication: Requires Bearer token.
Concurrency: Shares the per-PO Redis lock used by PATCH /api/purchase-orders/:purchase_order so concurrent edits on the same purchase order serialize rather than collide. The endpoint will wait up to 10 seconds for the lock; if it cannot acquire it, returns 409.
Request body (all fields optional — only sent fields are touched):
quantity(numeric, min 0, < 10000000): new ordered quantity. Validated againstreceived_quantityandinvoice_total— cannot drop below either.amount(numeric, min 0, < 10000000): unit cost.description(nullable string, max 255): free-text override for the product name on this line.tax_rate_id(nullable integer, exists intax_rates): set or clear the tax rate. When cleared,tax_allocationis reset to 0.discount(nullable numeric, 0–100): percentage discount. Stored asdiscount_rate(e.g. 25 → 0.25).nominal_code_id(nullable integer, exists innominal_codes).is_free_of_charge(boolean): toggle the FOC flag.free_of_charge_reason(nullable enum, required whenis_free_of_charge=true): one of theFreeOfChargeReasonEnumcases.
Side effects:
- Recomputes
tax_allocationwhenever the tax rate or any subtotal input (quantity/amount/discount) changes. - Recomputes the parent PO's
total_costandtotal_quantity. - Refreshes the PO's
receipt_statuswhen the quantity changes. - When the quantity is reduced, excess awaiting-receipt inventory allocations on this line are reverted so the next coverage sync can rebalance them.
Returns the refreshed PurchaseOrderLineResource.
Request
Responses
- 200
Successful response