[POST] .../v1/docinventory/edit
Edits inventory document. Use this method to update editable inventory document header fields before the document is closed. The request requires the inventory edit permission and the stock inventory tariff option; id is required, the document must exist, pass the document lock contract, remain not closed and not deleted and any new stock must be visible to the current request user. The method can change open_date, compare_type, stock_id, price_type_id, description, full/create_docinout flags, external_id and attached_user_id; changing the price type does not recalculate existing operation prices. Business errors such as missing body, invalid id, no editable fields, denied access, disabled tariff option, document not found, lock failure, closed or deleted state, stock access denial, excessive description length, database failures or action log failures are returned as HTTP 200 ErrorResult.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| attached_user_id | Int64 | Optional | Responsible user ID. |
| compare_type | String | Optional | Matching type: open_date - by opening date, close_date - by closing date, operation_date - by operation date. Allowed values: open_date, close_date, operation_date. |
| create_docinout | Boolean | Optional | Indicates whether write-off/receipt documents should be created automatically from the inventory document when inventory is closed: true - create, false - do not create. Default is true. When create_docinout is true, closing the inventory document with DocInventory/Close creates write-off/receipt documents based on the inventory document. The created documents are not linked to the inventory document, so reopening and closing the inventory document again creates new write-off/receipt documents. |
| description | String | Optional | Additional description. |
| external_id | String | Optional | External system document ID. |
| full | Boolean | Optional | Indicates whether the inventory is full. true - full, false - partial. Default is true. When true, closing the inventory document with DocInventory/Close adds all items from the document stock that have non-zero balances. Added rows use actual quantity 0 and accounting quantity equal to the stock balance: by opening date when matching type is open_date, otherwise by document closing date. When full is set, manually adding all items to the document is unavailable. |
| id | Int64 | Required | Inventory document ID. |
| open_date | Int64 | Optional | Inventory opening date as Unix time in seconds. |
| price_type_id | Int64 | Optional | Price type ID for adding a document operation. Prices in existing operations are not recalculated when the document price type changes. |
| stock_id | Int64 | Optional | Stock ID. |
Request Example
{
"attached_user_id": 1,
"compare_type": "open_date",
"create_docinout": true,
"description": "string",
"external_id": "string",
"full": true,
"id": 1,
"open_date": 1,
"price_type_id": 1,
"stock_id": 1
}
Response Parameters
| Name | Type | Description |
|---|---|---|
| ok | Boolean | Indicates whether the request completed successfully. |
| result | Update | Update operation result. |
Response Example
{
"ok": true,
"result": {
"ids": [
null
],
"row_affected": 1
}
}