Purchase Order
Update purchase order
Updates an existing purchase order's description, amount, currency, or items. When the total amount changes, item amounts are automatically recalculated based on their percentages.
Important Notes
- Purchase order must not be approved or completed
- User must have admin or owner role
- Item percentages must sum to 100% after update
- When amount_cents changes, all item amounts are recalculated
- Items can be created, updated, or deleted using nested attributes
Authorization
- User must be admin or owner of the company
- Purchase order cannot be approved or completed
Nested Item Updates
You can create, update, or delete items in the same request:
- Create: Include item without id field
- Update: Include item with existing id field
- Delete: Include item with id and _destroy: true
patch/v1/erp/payouts/purchase_orders/{id}
Path parameters
idstring uuid required
ID of the purchase order to update
Parameters
#/paths/~1v1~1erp~1payouts~1rules/get/parameters/0 — unresolved $ref
Request body
Example request
{
"purchase_order": {
"description": "Updated description",
"amount_cents": 60000000,
"currency": "CLP"
}
}Response
Purchase order updated successfully
Schema required— unresolved $ref