post_invoice
Post customer invoices or vendor bills to make them official and create A/R or A/P transactions. Handles foreign-currency exchange rates, refusing stale rates unless forced.
Instructions
Post a customer invoice or vendor bill.
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: Invoice or bill 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. owner_type: "customer" or "vendor" for disambiguation when IDs collide. 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 | ||
| owner_type | No | ||
| description | No | ||
| post_account | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |