post_document
Post a customer invoice, vendor bill, employee voucher, or credit note to A/R or A/P, finalizing the document as an official GnuCash transaction.
Instructions
Post a customer invoice, vendor bill, employee voucher, or credit note to A/R or A/P.
Posting creates a transaction in the A/R or A/P account and makes the invoice official. Once posted, entries cannot be added.
For a foreign-currency document, the exchange rate is etched
at posting and cannot be updated retroactively. If the latest
price for the invoice currency is more than 7 days from the
post date (the GNUCASH_FX_GUARD_DAYS window), posting is
refused with a stale_fx_rate error — run create_price
for a rate near the post date, then retry, or pass
force=True to post with the stale rate (recorded in the
response and audit log as fx_stale/"forced"). A rate
beyond the 90-day staleness cap cannot be forced.
Args: id: Document ID (e.g., "000001"). post_account: A/R or A/P account path (e.g., "Assets:Accounts Receivable"). post_date: Date in ISO format (YYYY-MM-DD). Defaults to today. due_date: Payment due date (YYYY-MM-DD). Optional. description: Description for the posting transaction. Optional. document_type: "invoice", "bill", "voucher", or "credit_note" — disambiguates when IDs collide. party_type: Owner side, credit notes only. force: Override the stale-FX-rate guard and post with a 7–90 day stale rate. Default False.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| force | No | ||
| due_date | No | ||
| post_date | No | ||
| party_type | No | ||
| description | No | ||
| post_account | Yes | ||
| document_type | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |