SetCostByLastPurchase

[POST] .../v1/purchaseoperation/setcostbylastpurchase

Sets item prices in operations according to last receipt prices from the partner. Use this method to fill purchase costs in the operations of a receipt-from-partner document from the last recorded purchase costs for the same items. The request requires document_id and the response returns row_affected with ids of operations whose cost was recalculated by the persistent layer. The caller must have purchase-operation edit permission; missing body, invalid document_id, denied access, missing historical costs, document state conflicts or persistent storage failures are returned as HTTP 200 ErrorResult business errors.

Request Parameters

Name Type Required Description
document_id Int64 Required Receipt-from-partner document ID.

Request Example

{
  "document_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
  }
}