Method

invoice.updateEntry

Change a line of an unposted document or open order.

Changes a line of an unposted document or an open order; fields you leave out stay as they are. A line stays on the documents and the order it was added to; this cannot move it. A line of a posted document or a closed order is refused with conflict.

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.updateEntry","params":{"entry":"5eff8018de334b2084ef00f90330cd57","price":"12.50","quantity":"2"}}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "guid": "5eff8018de334b2084ef00f90330cd57",
    "quantity": {
      "num": "2",
      "denom": "1"
    },
    "invoicePrice": {
      "num": "1250",
      "denom": "100"
    },
    "…": "…"
  }
}

Command line

red-ale exec --book book.gnucash invoice.updateEntry '{"entry":"5eff8018de334b2084ef00f90330cd57","price":"12.50","quantity":"2"}'

It prints:

{
  "guid": "5eff8018de334b2084ef00f90330cd57",
  "quantity": {
    "num": "2",
    "denom": "1"
  },
  "invoicePrice": {
    "num": "1250",
    "denom": "100"
  },
  "…": "…"
}

MCP tool call

Tool call:

{"name":"invoice.updateEntry","arguments":{"entry":"5eff8018de334b2084ef00f90330cd57","price":"12.50","quantity":"2"}}

Result:

{
  "structuredContent": {
    "guid": "5eff8018de334b2084ef00f90330cd57",
    "quantity": {
      "num": "2",
      "denom": "1"
    },
    "invoicePrice": {
      "num": "1250",
      "denom": "100"
    },
    "…": "…"
  }
}

Effect: write, on the Book.

Params

Params of invoice.updateEntry and order.updateEntry: the fields to change.

  • entry (Guid, required): The line.
  • date (Date or null): The line's date; stored as noon local time, as GnuCash's register does. Defaults to today.
  • description (string or null): Description.
  • action (string or null): Action: a free unit label such as "Hours".
  • notes (string or null): Notes.
  • quantity (Amount or null): Quantity, as printed on the document; stored negated on a credit note.
  • account (AccountRef or null): The income account (invoices) or expense account (bills, vouchers); null for none.
  • price (Amount or null): Unit price. A new line on a job's document defaults to the job's rate.
  • discount (Amount or null): Invoices only: the discount, a percentage or an amount. Defaults to the customer's discount.
  • discountType (AmountTypeWire or null): Invoices only: whether the discount is a percentage or an amount.
  • discountHow (DiscountHowWire or null): Invoices only: when the discount applies relative to tax.
  • taxable (boolean or null): Invoices and bills: the line is taxed. Defaults to true when a tax table applies.
  • taxIncluded (boolean or null): Invoices and bills: the price includes tax. Defaults from the customer's or vendor's setting.
  • taxTable (TaxTableRef or null): Invoices and bills: the tax table, by GUID or name; null for none. Defaults to the owner's table when it overrides, else the book's default.
  • billable (boolean or null): Bills and vouchers: the cost is to be invoiced on to billTo.
  • billTo (Guid or null): Bills and vouchers: the customer or job to invoice the cost to; null for none.
  • payment (PaymentWire or null): Vouchers only: cash (the employee paid) or card (the company card paid).

Result

A line. Both sides are shown; the one its document uses is invoice* for customer invoices and bill* for bills and vouchers.

  • guid (Guid, required): A GUID: 32 hexadecimal digits.
  • date (Timestamp, required): An instant, RFC 3339; written in UTC with a Z suffix.
  • dateEntered (Timestamp, required): An instant, RFC 3339; written in UTC with a Z suffix.
  • description (string, required)
  • action (string, required)
  • notes (string, required)
  • quantity (Amount, required): As stored: negated on a credit note.
  • documentQuantity (Amount, required): As printed on the document.
  • invoice (Guid or null): The customer invoice it is on.
  • bill (Guid or null): The bill or voucher it is on.
  • order (Guid or null): The order it is on.
  • invoiceAccount (Guid or null)
  • invoicePrice (Amount, required): An exact amount. Read from a decimal string ("12.34"), a rational string ("1234/100") or {num, denom} with string members; written as {num, denom}. Never a JSON number.
  • discount (Amount, required): An exact amount. Read from a decimal string ("12.34"), a rational string ("1234/100") or {num, denom} with string members; written as {num, denom}. Never a JSON number.
  • discountType (AmountTypeWire, required): Percentage or fixed amount.
  • discountHow (DiscountHowWire, required): When a discount applies relative to tax.
  • invoiceTaxable (boolean, required)
  • invoiceTaxIncluded (boolean, required)
  • invoiceTaxTable (Guid or null)
  • billAccount (Guid or null)
  • billPrice (Amount, required): An exact amount. Read from a decimal string ("12.34"), a rational string ("1234/100") or {num, denom} with string members; written as {num, denom}. Never a JSON number.
  • billTaxable (boolean, required)
  • billTaxIncluded (boolean, required)
  • billTaxTable (Guid or null)
  • billable (boolean, required)
  • billTo (OwnerInfo or null)
  • payment (PaymentWire, required): How an employee paid an expense.