update_voucher
Modify an existing TallyPrime voucher by matching its type, date, and number, then replace its ledger entries, narration, and related details while preserving correct voucher identity.
Instructions
Update an existing voucher in TallyPrime, replacing its ledger entries and narration. The voucher is matched by type + date + voucher number, so that combination must be unique and must exactly match an existing voucher (use get_ledger_vouchers or get_vouchers first to confirm it). Either pass debitLedger/creditLedger/amount for a simple 2-leg voucher, or pass 'entries' for 3+ lines, same as create_voucher. Refuses if another voucher type shares the same number on that date (confirmed live: Tally's Alter lookup ignores voucher type and can silently corrupt the wrong one) — resolve the collision in Tally first if that happens.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | Yes | Existing voucher's date in DD-MM-YYYY format | |
| mode | No | Tally's voucher entry mode (the 'Change Voucher Mode' choice in the voucher screen). 'Accounting Invoice' posts it as an invoice with plain ledger lines, the way invoice-mode Tax Invoices are entered — partyLedger is then required. 'As Voucher' posts the normal Dr/Cr voucher view and records that mode. Omit to post the normal voucher view without stamping a mode (right for Payment, Receipt, Contra). For Item Invoice (stock lines) use create_sales_invoice and its siblings instead. | |
| amount | No | New amount of the transaction (simple 2-leg mode; omit if using 'entries') | |
| entries | No | For a voucher with more than 2 lines: an array of { ledgerName, amount, type: 'debit'|'credit', billName?, billType?, costCentre?, costCategory?, description? }, same shape as create_voucher's entries. Debit and credit amounts must sum to the same total. When provided, this replaces debitLedger/creditLedger/amount. | |
| buyerTrn | No | The buyer's TRN on this voucher — same voucher-level field and Sales-class caveat as create_voucher's buyerTrn. | |
| buyerName | No | Name to print in this voucher's Buyer (Bill to) box, when it should differ from the customer ledger's own name — Tally's per-voucher Party Details mailing name. The ledger itself is not changed. Useful when many sales are posted against one shared ledger (e.g. cash or card sales) but each invoice needs its own readable buyer name. | |
| narration | No | New narration / description for the voucher | |
| reference | No | Free-text reference for this voucher, backed by Tally's voucher-level REFERENCE field — same field and same independence from voucherNumber/bill references as on create_voucher. | |
| buyerState | No | The buyer's Emirate/state on this voucher's Party Details. | |
| debitLedger | No | Ledger name to debit (simple 2-leg mode; omit if using 'entries') | |
| partyLedger | No | The customer or supplier ledger the invoice is raised on — required with mode 'Accounting Invoice', and must be one of this voucher's own ledger lines (it's placed first and marked as the party, as Tally does). | |
| voucherType | Yes | Voucher type, e.g. 'Payment', 'Receipt', 'Journal' | |
| buyerCountry | No | The buyer's country on this voucher's Party Details. | |
| costCategory | No | Cost category the cost centre belongs to. Defaults to 'Primary Cost Category'. | |
| creditLedger | No | Ledger name to credit (simple 2-leg mode; omit if using 'entries') | |
| referenceDate | No | Date for the reference above, in DD-MM-YYYY format (Tally's REFERENCEDATE field). Independent of the voucher's own date. | |
| voucherNumber | Yes | Exact voucher number of the voucher to update | |
| debitCostCentre | No | Cost centre to allocate the debit leg to (optional). | |
| creditCostCentre | No | Cost centre to allocate the credit leg to (optional). | |
| debitDescription | No | Additional description lines for the debit leg (Tally's 'Additional Descriptions for Ledgers'), one array entry per line. This update replaces the voucher's ledger lines, so pass the existing descriptions again if they should be kept — omitting them here removes them. | |
| creditDescription | No | Same as debitDescription, for the credit leg. | |
| placeOfSupplyCountry | No | UAE VAT Place of Supply Country for this voucher. | |
| placeOfSupplyEmirate | No | UAE VAT Place of Supply Emirate for this voucher. |