Method

invoice.unpost

Unpost a document: delete its posted transaction and lot links; payments stay as pre-payments.

Unposts a document: deletes its transaction and the lot links to other documents, so it can be edited, and puts it back as unposted. Payments made against it are not deleted: they stay in its lot as pre-payments of the owner, ready to be applied again. A lot left empty is deleted. The document keeps its frozen billing term; with resetTaxTables its lines go back to the tax tables the frozen copies came from.

Examples

Example: with a copy of the synthetic/business-editable example book open as book.gnucash.

JSON-RPC

Request:

{"jsonrpc":"2.0","id":1,"method":"invoice.unpost","params":{"invoice":"aa210b7131de44c48b8513cd27c00e95"}}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {}
}

Request:

{"jsonrpc":"2.0","id":2,"method":"invoice.get","params":{"invoice":"aa210b7131de44c48b8513cd27c00e95"}}

Response:

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "posted": false,
    "datePosted": null,
    "postedTransaction": null,
    "postedLot": null,
    "…": "…"
  }
}

Command line

red-ale exec --book book.gnucash --script - <<'EOF'
invoice.unpost {"invoice":"aa210b7131de44c48b8513cd27c00e95"}
invoice.get {"invoice":"aa210b7131de44c48b8513cd27c00e95"}
EOF

It prints:

[
  {},
  {
    "posted": false,
    "datePosted": null,
    "postedTransaction": null,
    "postedLot": null,
    "…": "…"
  }
]

MCP tool call

Tool call:

{"name":"invoice.unpost","arguments":{"invoice":"aa210b7131de44c48b8513cd27c00e95"}}

Result:

{
  "structuredContent": {}
}

Tool call:

{"name":"invoice.get","arguments":{"invoice":"aa210b7131de44c48b8513cd27c00e95"}}

Result:

{
  "structuredContent": {
    "posted": false,
    "datePosted": null,
    "postedTransaction": null,
    "postedLot": null,
    "…": "…"
  }
}

Effect: destructive, on the Book.

Params

Params of invoice.unpost.

  • invoice (Guid, required): The posted document.
  • resetTaxTables (boolean): Point the entries back at the tax tables their frozen copies came from (GnuCash's dialog default: false).

Result

A result with nothing to report.

Type: Done.