Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Bug: PATCH /v1.0/warehouseItems/{id}: reservedQuantity ignored
Hello *,
here's how to reproduce the bug:
1. Go to your liferay-instance and log in.
2. Open the "Liferay Commerce Admin Inventory API", i.e. https://HOST/liferay/o/api?endpoint=https://HOST/liferay/o/headless-commerce-admin-inventory/v1.0/openapi.json
3. Get a valid warehouse-item, e.g. by first querying your warehouses and then the items of one of these warehouses. For my example, I have this warehouse-item:
{
"externalReferenceCode": "52435fdc-f94a-ec13-765e-3933eb3630c0",
"id": 40958,
"quantity": 94,
"reservedQuantity": 10,
"sku": "CABUT310",
"unitOfMeasureKey": "",
"warehouseExternalReferenceCode": "e1409d48-3439-89f6-31ee-89ca317d85c7",
"warehouseId": 34549
}
4. Copy+paste this JSON into the request-body of "PATCH /v1.0/warehouseItems/{id}" and then change the quantity as well as the reservedQuantity, e.g. like this:
{
"externalReferenceCode": "52435fdc-f94a-ec13-765e-3933eb3630c0",
"id": 40958,
"quantity": 92,
"reservedQuantity": 12,
"sku": "CABUT310",
"unitOfMeasureKey": "",
"warehouseExternalReferenceCode": "e1409d48-3439-89f6-31ee-89ca317d85c7",
"warehouseId": 34549
}
Here, I changed the quantity from 94 to 92 and the reservedQuantity from 10 to 12.
5. Click "Execute". You should receive a success (HTTP 200).
6. Query the warehouse-item again. FAIL: The quantity was updated correctly, but the reservedQuantity was not updated!
Just for the record: I also tried to update only the reservedQuantity (leaving everything else unchanged) and I also tried reducing the JSON to only what I wanted to update and it all didn't work.
Please fix this bug as soon as possible. It seems it's currently not possible at all to change the reservedQuantity via RESTful API.
In case you have questions, please don't hesitate to ask here or contact me via e-mail.
Best regards, Marco :-)
Related bug: Quantity (and reserved quantity) in RESTful API does not support decimal values.
Go to the "Commerce"-admin and create an entry under
"Inventory" having a quantity of 5.255 and a reserved
quantity of 1.128. Then go to
https://HOST/liferay/o/api?endpoint=https://dragonkingchocolate.com:1443/liferay/o/headless-commerce-admin-inventory/v1.0/openapi.json
and perform GET
/v1.0/warehouses/{id}/warehouseItems -- the
decimal values are gone.
The same btw. when you edit the previously stored inventory-item in "Commerce" > "Inventory" again: I saved quantity = 5.255 and reserved quantity = 1.128, but when editing it again, it shows only 5 and 1 (instead of 5.255 and 1.128). This sucks. I want to track many items in kg, but often have 0.5 kg or 0.25 kg going in or out of the inventory. I don't want to track it in g, because we have over 1000 kg in stock. In the DB it is clearly a BigDecimal, but Liferay sometimes rounds/truncates the values.
Powered by Liferay™