E151: Update sales order item
PATCH /api/sales-order-items/:id
Edits a single SO line. Triggered from Sales Order Detail items section. Quantity and SKU changes propagate to the FG ledger so DEMAND and ALLOCATE entries stay accurate.
Authentication
Standard tenant route. Requires Authorization: Bearer <firebase-id-token> and X-Org-Id: <org-id>. Access: Member.
Request
{ "quantity": 60, "unitPrice": 47.00 }
Quantity changes write a REVERSE_DEMAND for the prior amount plus a fresh DEMAND for the new amount (append-only ledger).
Response — 200 OK
{ "id": "uuid", "soId": "uuid", "skuId": "uuid", "quantity": 50, "unitPrice": 48.00, "allocatedQuantity": 50, "shippedQuantity": 0 }
Errors
| HTTP | code | Condition |
|---|---|---|
| 404 | not_found | No such item. |
| 409 | invalid_transition | Parent SO terminal, or item already partly shipped. |
| 422 | validation_failed | Shape invalid. |
Workflow
Calls W151 Update sales order item.