There are two ways to define the "consume amount/quantity" when using the "consume" API endpoint from what I can tell. The first you appeared to fix in issue #50 so that the app correctly uses the product's quick_consume_amount. However, I have several products that we buy in different sizes. I have different barcodes for each package size, and the amount field for that barcode is defined so that when we purchase an item or consume and item by scanning that barcode the correct amount is added or removed from inventory.
When I scan that barcode in my Android App, the consume amount is set to that barcode's amount - 6 in this case. I suspect the Android app is querying the API to grab that data and updating the "consume" view with that amount if it is set.
Request: I think that if a barcode is scanned and it has an "amount" set to something different from the Grocy or product default, that barcode's amount should be used. It would likely require an extra GET to the API here: https://en.demo.grocy.info/api/stock/products/by-barcode/123456789001 to get the amount, and then using that value if it is different than what is returned by the quick_consume_amount returned by https://en.demo.grocy.info/api/stock/products/7.
There are two ways to define the "consume amount/quantity" when using the "consume" API endpoint from what I can tell. The first you appeared to fix in issue #50 so that the app correctly uses the product's
quick_consume_amount
. However, I have several products that we buy in different sizes. I have different barcodes for each package size, and theamount
field for that barcode is defined so that when we purchase an item or consume and item by scanning that barcode the correct amount is added or removed from inventory.In the demo server I added a barcode (123456789001) with an amount of "6" to demonstrate this: https://en.demo.grocy.info/product/7?returnto=%2Fstockoverview
When I scan that barcode in my Android App, the consume amount is set to that barcode's amount - 6 in this case. I suspect the Android app is querying the API to grab that data and updating the "consume" view with that amount if it is set.
Request: I think that if a barcode is scanned and it has an "amount" set to something different from the Grocy or product default, that barcode's amount should be used. It would likely require an extra GET to the API here: https://en.demo.grocy.info/api/stock/products/by-barcode/123456789001 to get the
amount
, and then using that value if it is different than what is returned by thequick_consume_amount
returned by https://en.demo.grocy.info/api/stock/products/7.Thanks for your consideration, Georg!