Method

order.update

Change an order.

Changes an order's number, dates, notes, reference or active state. The owner can change only while the order has no lines. To change its lines use order.updateEntry.

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":"order.create","params":{"owner":"5b22073fa4e34411b07c14a77147ce6b"}}

Response:

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

Request:

{"jsonrpc":"2.0","id":2,"method":"order.update","params":{"order":"00ed0000000000000000000000000001","notes":"Rush"}}

Response:

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "notes": "Rush",
    "closed": false,
    "…": "…"
  }
}

Command line

red-ale exec --book book.gnucash --script - <<'EOF'
order.create {"owner":"5b22073fa4e34411b07c14a77147ce6b"}
order.update {"order":"00ed0000000000000000000000000001","notes":"Rush"}
EOF

It prints:

[
  "…",
  {
    "notes": "Rush",
    "closed": false,
    "…": "…"
  }
]

MCP tool call

Tool call:

{"name":"order.create","arguments":{"owner":"5b22073fa4e34411b07c14a77147ce6b"}}

Result:

{
  "content": [
    {
      "type": "text",
      "text": "\"…\""
    }
  ]
}

Tool call:

{"name":"order.update","arguments":{"order":"00ed0000000000000000000000000001","notes":"Rush"}}

Result:

{
  "structuredContent": {
    "notes": "Rush",
    "closed": false,
    "…": "…"
  }
}

Effect: write, on the Book.

Params

Params of order.update: the fields to change.

  • order (Guid, required): The order.
  • owner (Guid or null): A customer, vendor or job. It can change only while the order has no lines.
  • id (string or null): Order number. On create, absent or empty takes the next number from the book's gncOrder counter.
  • dateOpened (Date or null): Date opened; stored as noon local time. Defaults to today.
  • notes (string or null): Notes.
  • reference (string or null): Reference.
  • active (boolean or null): Active; false deactivates.

Result

An order with its lines, in GnuCash's order.

  • guid (Guid, required): A GUID: 32 hexadecimal digits.
  • id (string, required)
  • owner (OwnerInfo, required): An owner: a customer, vendor, employee or job.
  • dateOpened (Timestamp, required): An instant, RFC 3339; written in UTC with a Z suffix.
  • closed (boolean, required)
  • dateClosed (Timestamp or null)
  • notes (string, required)
  • reference (string, required)
  • active (boolean, required)
  • entryCount (integer (uint), required)
  • entries (array of EntryInfo, required): Its lines.