Add

[POST] .../v1/wholesalereturnoperation/add

Adds item lines to a wholesale customer return document. Add one or more item lines to a DocWholeSaleReturn document before the document is posted. When the document has a price type, each zero price or price2 is replaced with the item price from that type; a missing catalog price uses 0. Amounts are converted from the price-type currency to the document currency, price uses the price-type rounding step and price2 uses two decimal places. Without a price type, submitted prices are preserved. Invalid currency rates return HTTP 200 ErrorResult with error 1008. The request body is a JSON array batch; every operation must contain document_id, item_id, positive quantity up to 999999999, price and price2 values from 0 to 99999999999, optional order, optional VAT value and optional description up to 300 characters and all array items must reference the same document_id. The parent DocWholeSaleReturn must be locked by the current user and eligible for editing and the item must be an active non-compound leaf item; null, empty or oversized arrays, invalid values, mixed document_ids, denied access or document/item state conflicts are returned as HTTP 200 ErrorResult.

Request Parameters

Name Type Required Description
description String Optional Operation note. Maximum length is 300 characters.
document_id Int64 Required Return-from-partner document ID.
item_id Int64 Required Item ID.
order Int64 Optional Operation order. NULL means not set and is stored as NULL in the database. Ignored for database versions earlier than 363.
price Decimal Required Discounted return price. Required, from 0 to 99999999999. If the document has a price type, 0 uses its item price, amounts are converted from the price-type currency to the document currency and price-type rounding is applied. Without a price type, 0 stays 0.
price2 Decimal Required Return price before discount. Required, from 0 to 99999999999. If the document has a price type, 0 uses its item price and amounts are converted from the price-type currency to the document currency with two decimal places. Without a price type, 0 stays 0.
quantity Decimal Required Returned item quantity. Must be greater than zero and no greater than 999999999.
vat_value Decimal Optional VAT rate value. Null uses the item's VAT rate; -1 is accepted for document/default VAT behavior.

Request Example

[
  {
    "document_id": 5601,
    "item_id": 1001,
    "quantity": 1,
    "order": 10,
    "price": 50000,
    "price2": 52000,
    "vat_value": 12,
    "description": "Returned by partner"
  }
]

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,
    "ids": [
      9601
    ]
  }
}