SetCostByLastPurchase
[POST] .../v1/purchaseoperation/setcostbylastpurchase
Sets purchase receipt line costs using the last purchase prices from the supplier. 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 method. The caller must have purchase-operation edit permission; missing body, invalid document_id, denied access, missing historical costs, document state conflicts or storage failures are returned as HTTP 200 ErrorResult.
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
}
}