ERP: Record a purchase from a supplier
erp_purchase_recordRecord a PURCHASE of goods from a supplier that already arrived: a purchase order, its confirmation and the goods receipt into the warehouse — the stock GROWS; each purchase price becomes the item's cost (update_cost=false keeps the old cost). Use for «прийшла закупка від …», «купив у постачальника …», «внеси закупку». 'supplier' = the supplier's name (a new name creates the supplier, the card says so); each line: 'item' as written, 'quantity', 'cost' = the purchase price of ONE unit. 'date' YYYY-MM-DD if not today («позавчора» → compute the date). 'supplier_document' = their invoice / waybill number, if said. Items not in the catalog are refused (create them with erp_product_create first). A supplier's invoice as a PDF / photo goes through purchase_invoice_create_from_file instead. The same purchase twice is refused (again_ref only for a second identical delivery). Proposed write: one card with every line and stock before → after. CONFIRMATION: this tool is PROPOSED, never performed directly. You get status='confirmation_required' with an action_id and a plan_token, and the write happens only after confirm_action.
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": {
"lines": "<lines>"
},
"name": "erp_purchase_record"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | No | ||
| lines | Yes | ||
| total | No | ||
| currency | No | ||
| supplier | No | ||
| again_ref | No | ||
| warehouse | No | ||
| supplier_id | No | ||
| update_cost | No | ||
| new_supplier | No | ||
| supplier_document | No |