Edit

[POST] .../v1/docadditionalexpenses/edit

Edits additional expense document. Use this method to update an additional expenses document before it is posted. The request requires the additional expenses edit permission; id is required, the document must exist, must not be posted, must not be blocked, must not be deleted and at least one editable field must be supplied. Standalone documents can change date and stock, while documents linked to DocPurchase keep date and stock controlled by the parent purchase; linked documents require the parent purchase to exist, be locked by the current workflow and remain not posted. Optional patch fields leave existing values unchanged when omitted; contract_id = 0 removes the contract, null leaves it unchanged and an empty description clears the note. Business errors such as missing body, invalid id, denied access, document not found, already posted or blocked state, unsupported or posted parent document, parent lock failure, unknown currency, invalid exchange rate, closed period, stock access denial, no editable fields, database failures or action log failures are returned as HTTP 200 ErrorResult.

Request Parameters

Name Type Required Description
contract_id Int64 Optional Contract ID. Send 0 to remove the contract.
currency_id Int64 Optional New currency ID. Values less than or equal to 0 leave it unchanged.
date Int64 Optional New standalone document date as Unix time in seconds. Values less than or equal to 0 leave it unchanged; linked DocPurchase documents take the date from the parent purchase.
description String Optional Document note patch value. Null leaves it unchanged; an empty string clears the note. Maximum length is 300 characters.
exchange_rate Decimal Optional New exchange rate with up to 8 decimal places. Negative values are rejected; 0 leaves a non-base currency rate unchanged and base currency forces 1.
id Int64 Required Required additional expenses document ID.
partner_id Int64 Optional New partner ID. Values less than or equal to 0 leave it unchanged.
stock_id Int64 Optional New stock ID. Values less than or equal to 0 leave it unchanged; linked DocPurchase documents keep the parent purchase stock.
vat_calculation_type String Optional VAT calculation mode: No - do not accrue, Exclude - included in the amount, Include - added on top. Allowed values: No, Exclude, Include.

Request Example

{
  "id": 56,
  "partner_id": 15,
  "currency_id": 1,
  "description": "Updated freight costs for purchase PUR-000042",
  "vat_calculation_type": "No"
}

Response Parameters

Name Type Description
ok Boolean Indicates whether the request completed successfully.
result Update Update operation result.

Response Example

{
  "ok": true,
  "result": {
    "row_affected": 1
  }
}