File a pending draft invoicing open delivery orders (a person approves in Taokeh)
create_delivery_order_invoice_draftFiles a pending draft of Invoice on Delivery orders: one invoice for one or more open delivery orders of one customer in one currency, as the Consolidate → Invoice page does with those orders ticked. paymentMethod CREDIT (on account, the default) takes an optional term and dueDate (left out: derived from the term, as the page does); CASH takes neither. The tax rate box is left blank and the default stock location is used, as on the page; the location stock comes off is named in the result. Nothing is posted until an admin or bookkeeper approves in Taokeh; approval invoices them exactly as the page does, marks each delivery order invoiced and, on perpetual stock, moves the stock. The result carries the invoice (customer, lines, subtotal, tax, total, stock moved) and the journal lines, as the rolled-back invoice produced them; its number is given at approval. Refused at filing and approval in the page's words: a delivery order not open, two customers or two currencies, an order made from a quote that charged one tax rate when the rate cannot be told (it is typed on the page), a date in a locked period, a stock shortfall. Also refused at filing: a delivery order already in another invoice draft waiting for approval. One draft per set of orders waits at a time; if an order is edited, invoiced or voided before approval, approval refuses and nothing is posted.
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": {
"deliveryOrderIds": "<deliveryOrderIds>",
"saleDate": "<saleDate>"
},
"name": "create_delivery_order_invoice_draft"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | A short note for the reviewer: where the figures came from. | |
| term | No | On account: the payment term, as the invoice form takes it (e.g. Net 30). | |
| dueDate | No | On account: the due date, YYYY-MM-DD, on or after the invoice date (left out: from the term). | |
| saleDate | Yes | The invoice date, YYYY-MM-DD. | |
| needsReview | No | true flags the draft for the reviewer. | |
| paymentMethod | No | `CREDIT` (on account, default) or `CASH` (paid now). | |
| deliveryOrderIds | Yes | The open delivery orders, from search_documents (docType `delivery_order`). One customer, one currency, at most 50. |