ms_build_document
Preview a draft document by specifying type, counterparty, and line items. Resolves names to references and shows the exact body that would be sent, without creating the document.
Instructions
PREVIEW any role document: resolve names to refs and show the EXACT body ms_create_document would send (money already kopecks). READS only; no write.
Args: doc_type: one of demand | supply | purchaseorder | invoiceout | invoicein | salesreturn | purchasereturn. agent: counterparty name — supplier for supply/invoicein/purchasereturn/ purchaseorder, customer for demand/invoiceout/salesreturn. organization: own legal entity; omit to auto-use the only one on the cabinet. store: warehouse name. supply/demand move stock, so a store is expected; optional for the others. positions: list of {"product": name, "quantity": n, "price": rubles, optional "discount" %, "vat" %}. moment/name/description: optional. moment is "YYYY-MM-DD HH:MM:SS". Returns {"ok": true, "doc_type", "body", "resolved", "summary"} or an error.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | ||
| agent | Yes | ||
| store | No | ||
| moment | No | ||
| doc_type | Yes | ||
| positions | No | ||
| description | No | ||
| organization | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |