File supplier debit note draft
create_supplier_debit_note_draftFiles a debit-note draft against one supplier bill: goods sent back to the supplier, or a credit the supplier gave on that bill. It lowers what is owed to the supplier once a person approves it in Taokeh; nothing posts before then. purchaseId is the bill's id (search_documents, docType 'bill'); the bill must be in ringgit. Each line names a product on that bill (productId from resolve_product), the quantity, and optionally unitAmount (default: the bill line's cost) and billLineNo (needed when the product is on more than one line of the bill). goodsReturned on each line says whether the goods physically went back; it only pre-selects the reviewer's answer. The draft is approved on its review page only, where the person decides line by line whether stock goes out; there is no one-tap approval link. One draft waits per bill: a second filing on the same bill is refused, naming the waiting draft, which revise_draft changes or, if you filed it, withdraw_draft takes back (a draft older than 30 days is replaced). The bill line's discount is shared out by quantity when a line is returned at the bill's cost; tax follows the bill. At filing the note is run through the same checks as the app's debit-note form: never dated before the bill, not in a locked period, no more than the bill still has un-returned per product, and above what the bill still owes the supplier's credit note number (supplierCreditNoteNo) is needed. A refusal files nothing and names the fix. Returns the draft id, the note's computedTotal and the review link.
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": {
"purchaseId": "<purchaseId>",
"dnDate": "<dnDate>",
"lines": "<lines>"
},
"name": "create_supplier_debit_note_draft"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lines | Yes | ||
| notes | No | Short reviewer note (one or two sentences, in the reviewer's language) naming what to double-check: a smudged total, an uncertain party, a judgment call. Shown on the approval card. Empty when nothing needs flagging. | |
| dnDate | Yes | The debit-note date, YYYY-MM-DD (not before the bill date). | |
| reason | No | Why the goods went back or the credit was given; it prints on the note. | |
| purchaseId | Yes | The supplier bill's id (search_documents, docType 'bill'). | |
| needsReview | No | ||
| supplierCreditNoteNo | No | The number on the supplier's own credit note, when there is one. Needed when the note is more than the bill still owes. |