Updates a production run. Only the fields you pass are changed, the rest stay as they were.
v1/production/edit.php
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| production_id | int | Yes | Production run ID |
| products | array | No | Products to make: id or sku and amount, as in v1/production/add. Replace the current ones as a whole |
| date | string | No | Production date, YYYY-MM-DD |
| name | string | No | Name |
| notes | string | No | Notes |
| produce_subproducts | int | No | 1: produce subassemblies together with the products, 0: deduct them from stock |
| materials_storage_id | int | No | Storage location materials are deducted from. 0: choose automatically |
| subproducts_storage_id | int | No | Storage location used products are deducted from. 0: choose automatically |
| products_storage_id | int | No | Storage location the produced products are added to |
The status is not changed by this method; use v1/production/update_status. The number cannot be changed.
Example request
{
"production_id": 39978,
"products": [
{
"id": 512,
"amount": 12
}
],
"notes": "Added two tables"
}
Example response
{
"success": true
}
Errors
| Error | Reason |
|---|---|
| No production_id in input | production_id is missing |
| Production not found or access denied | Production run not found or deleted |
| Products of a production linked to a sale cannot be changed. Edit the sale instead | Changing the products of a made-to-order production |
| No products in input | An empty products array was passed |
| Products is not an array | products is not an array |
| Product with id 512 not found | Product not found or deleted |
| Amount must be greater than 0 for product with id 512 | Quantity is not a number or not above 0 after rounding |
| Storage ID is not set | products_storage_id equal to 0, or an empty storage location, was passed |
| Storage ID not found | Storage location not found or deleted |
| Date is not a valid date in format YYYY-MM-DD | Invalid date format |
Other products line errors are the same as in v1/production/add.