File debit-note draft
create_debit_note_draftFiles a pending sell-side debit-note draft: an additional charge on an invoice this business already issued (an undercharge, a price revised upward after delivery, a missed surcharge). It does not post; on approval in Taokeh it increases what the customer owes and the output SST. Field shapes: intake_contract(doc_type:'sales_debit_note'). The original invoice is required (originalDocId from search_documents, or originalDocNumber); there is no standalone shape, and a charge with no invoice behind it is a new invoice (create_invoice_draft). unitAmount is the amount added per unit (the shortfall, not the new price); quantity defaults to 1. Every line names a product that appears on that invoice. Money only: a debit note moves no stock and touches no COGS; extra goods delivered are a new invoice. There is no cap on the charge; the approver sees the original invoice's total beside it, and the result returns it as against.invoiceTotal. A one-tap approval is refused if the total changed since filing (for example an SST change). An invoice reversed from a Shopee, TikTok or Shopify Returns page is refused at filing and at approval. Scope: Taokeh's /debit-notes page is the buy side (purchase returns), with no AI lane for creating one; a posted buy-side note is corrected by update_supplier_debit_note_draft. A posted sell-side debit note has no correction lane: the owner voids it in Taokeh and a new one is filed. A filed draft is amended by revise_draft (kind 'sales_debit_note'). Line keys outside the schema are refused by name, with the likely intended key, and nothing is filed.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"dnDate": "<dnDate>",
"lines": "<lines>"
},
"name": "create_debit_note_draft"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lines | Yes | ||
| notes | No | A short note for the reviewer (one or two sentences, shown at approval): what to double-check, such as which invoice it was matched to and where the figure came from. | |
| dnDate | Yes | The debit-note date, YYYY-MM-DD in Malaysia time (MYT). A date before the invoice's date is refused, naming the invoice's date. | |
| reason | No | Why more is charged — 'price revised upward after delivery', 'surcharge missed'. It prints on the note. | |
| customer | No | Optional cross-check: the customer the invoice is believed to belong to. The customer comes from the invoice; a name that does not match is refused. | |
| reference | No | The debit-note number already printed on paper, if any. Leave it out and Taokeh numbers it (DN…). | |
| customerId | No | The resolved customer id, as the same cross-check. | |
| needsReview | No | ||
| printedTotal | No | The total printed on the paper, if any. Cross-check only — the server computes the real total and flags a mismatch on the approval screen. | |
| originalDocId | No | The original invoice's id, from search_documents (this or originalDocNumber is required). The server checks it exists, is an invoice, and whose it is. | |
| originalDocNumber | No | The printed invoice number, when there is no id. Refused if more than one document carries it. |