create_credit_note
Creates an item-invoice credit note in TallyPrime for sales returns, reversing stock and revenue for returned items and crediting the customer ledger.
Instructions
Create an item-invoice Credit Note in TallyPrime — a Sales return, reversing stock and revenue for returned items. Same shape as create_sales_invoice but with the debit/credit convention flipped, matching Purchase's sign pattern (a Credit Note is structurally a reverse Sales entry). Confirmed live on a real company: returning 5 units correctly increased the item's book quantity by exactly 5. Same godown and dual-role deletion caveats as create_sales_invoice apply.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | Yes | Credit note date in DD-MM-YYYY format | |
| items | Yes | One entry per returned line. | |
| billName | No | Bill reference to settle against, e.g. the original invoice's bill name. Defaults to 'Agst Ref' billType. | |
| billType | No | Defaults to 'Agst Ref' — settling against the original invoice's bill, unlike create_sales_invoice's 'New Ref' default. | |
| buyerTrn | No | The buyer's (customer's) TRN as it should appear on this credit note (Tally's TRADERCONSVATTINNO/BASICBUYERSSALESTAXNO fields) — a per-voucher snapshot, not inherited from the party ledger master. | |
| 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 | Narration / description | |
| reference | No | Free-text reference for this credit note (Tally's voucher-level REFERENCE field). | |
| vatLedger | No | Default VAT ledger for items without their own override. | |
| buyerState | No | The buyer's Emirate/state on this credit note's Party Details (voucher-level STATENAME). | |
| partyLedger | Yes | Customer ledger name (the party being credited) | |
| voucherType | No | Voucher type to post as, for a company that uses its own Credit Note-class type in Item Invoice mode (e.g. 'Tax Invoice', 'Export Invoice'). Defaults to 'Credit Note'. | |
| buyerCountry | No | The buyer's country on this credit note's Party Details (voucher-level COUNTRYOFRESIDENCE). | |
| referenceDate | No | Date for the reference above, in DD-MM-YYYY format. | |
| voucherNumber | No | Explicit voucher number. Normally omit and let Tally auto-number — but some Tally configurations stop auto-numbering item-invoice vouchers via the XML gateway (confirmed live). If creation fails with a blank EXCEPTIONS:1, check get_vouchers for the highest existing number of this voucher type and retry with voucherNumber set to the next one. | |
| vatRatePercent | No | Default VAT rate. Required if vatLedger is set. | |
| placeOfSupplyCountry | No | UAE VAT Place of Supply Country (Tally's PLACEOFSUPPLYCOUNTRY field). | |
| placeOfSupplyEmirate | No | UAE VAT Place of Supply Emirate for this credit note (Tally's EMIRATEPOS field). |