Cancel sales invoice
Cancels a submitted sales invoice and reverses its ledger entries.
MCP tool erpnext_write → cancel_sales_invoice
write Confirm
Moves a submitted Sales Invoice to cancelled (docstatus 2) and reverses its ledger effects. ERPNext's guide says to handle linked payments, returns and stock transactions first; the call returns ERPNext's error if something still links to the invoice. A cancelled invoice cannot be edited, so create a new draft to replace it. By default you confirm each call; you can switch that off for this tool.
Parameters
| Name | Type | Description |
|---|---|---|
| invoice string required | string | Sales Invoice ID from list_sales_invoices or create_sales_invoice. |
tools/call
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "erpnext_write",
"arguments": {
"operation": "cancel_sales_invoice",
"arguments": {
"invoice": "invoice"
}
}
}
} Example response
{
"content": [
{
"type": "text",
"text": "{ ... same JSON as structuredContent ... }"
}
],
"structuredContent": {
"invoice": "ACC-SINV-2026-00042",
"status": "Cancelled",
"docstatus": 2
},
"isError": false
}