patzly / grocy-android

ERP beyond your fridge, now on your phone – An awesome companion app for grocy
https://patrickzedler.com/grocy/
GNU General Public License v3.0
842 stars 80 forks source link

Consume on individual Grocy barcode also decreases other stock entries #761

Open jtommi opened 10 months ago

jtommi commented 10 months ago

I'm printing individual barcodes for every unit in stock.

Let's imagine I purchased 6 units. Grocy will print 6 different labels and create 6 stock entries with different stock_ids (e.g. x63079dba2022b) When I consume one of these barcodes, of course the total quantity decreases. But then I can scan that same barcode again and the total quantity will decrease again.

I tried the API endpoint (/stock/products/by-barcode/:grocycode/consume) directly and at the second request, I get {` "error_message": "No transaction was found by the given transaction id" } and the total stock quantity is not decreased.

So my guess is that the app uses the Grocy barcode to find the product, and then uses the resulting product ID to consume the unit via the API.

I tested this with app v3.3.1 and Grocy v4.0.2

dominiczedler commented 9 months ago

Does the app display the message "stock entry from grocycode not found"? Maybe if you are using the quick mode, this message is not visible. Can you turn quick mode off and tell me if it is displayed? This would be no bug, more an improvement that the message should be displayed also in quick mode.

dominiczedler commented 7 months ago

Could you please answer my questions? Without further details, I can't solve the issue.

jtommi commented 7 months ago

Could you please answer my questions? Without further details, I can't solve the issue.

Yep, sorry, I didn't take the time yet to try it. I think I'll give it a try this week

jtommi commented 7 months ago

@dominiczedler So I finally took some time to update the server, app, make sure everything is connected, etc. I tried what you said and I get exactly the message you said "stock entry from grocycode not found". So it's indeed an improvement. But I would rather go with a setting that says something like "Default to main product when no stock entry from grocycode is found" which I'd want to disable in my case.