POST reverse_allocation
Reverse an Active Allocation Run. Creates a reversal run and cancels the original.
Endpoint
POST /api/method/konsol.api.reverse_allocation
Authentication: Required (Frappe session cookie)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Document name of the Allocation Run to reverse |
What Happens
- Validates the run is in "Active" status
- Creates a new Allocation Run with
reversal_ofpointing to the original - Submits the reversal (becomes Active, synced to ClickHouse)
- Cancels the original (status set to "Reversed", synced to ClickHouse)
Response
{
"message": {
"original": "ARUN-2025-P6-0001",
"reversal": "ARUN-2025-P6-0002",
"status": "Reversed"
}
}
Example
curl -X POST http://localhost:8069/api/method/konsol.api.reverse_allocation \
-H "Content-Type: application/json" \
-b "cookies.txt" \
-d '{"name": "ARUN-2025-P6-0001"}'
Error Responses
Wrong status
{
"exc_type": "ValidationError",
"_server_messages": "[\"Cannot reverse: current status is 'Reversed', expected 'Active'\"]"
}
dbt Impact
After reversal:
- Original run:
status = 'Reversed' - Reversal run:
status = 'Active' gold_allocation_resultsapplies nostatusfilter — it does not itself include or exclude runs based on Active/Reversed.gold_allocation_audit_trailjoins each run's status againstgold_allocation_resultsand negates the allocated amount forReversedruns (status = 'Reversed'⇒-allocated_amount), so both the original and the reversal appear there and net to zero for full traceability.
See also: run_allocation, allocation_history