supergeorg / Grocy-SwiftUI

A client for Grocy for macOS and iOS, written with SwiftUI
GNU General Public License v3.0
181 stars 18 forks source link

Add of userfields in products #93

Open Will711990 opened 2 years ago

Will711990 commented 2 years ago

Hi,

I added personal userfields in products, and in barcode:

image

Does it possible to integrate them in app ?

Thank you ! :)

supergeorg commented 2 years ago

It would be possible, but only via an implementation of custom user fields.

BTW: what do you want to do with this custom fields? Wouldn't it be easier if you realize this via unit conversions? They should work somehow (I haven't tested them throroughtly and you can only set them in the web gui for now) in the app and I am trying to improve its behavior.

Will711990 commented 2 years ago

Hi, sorry for this really late answer. I understand about implementation of custom user fields, maybe later :)

To answer to your question, I found unit conversions not convenient in Grocy, because it depends on packaging of products.

For example:

Tomato sauce can be packaging:

I would not create 2 products differents for these cases (pretty current).

So I created Userfields:

Also, if Consumption = Barcode, batch is True, and Number per batch= 3 when I scan the barcode of batch it divides the quantity by Number of Batch.

Example: 1 barcode of 3 cartons of Tomato sauce of 0,120l each = total of 0,320L When I scan the barcode as Consume, I remove only 0,120L, instead of 0,320L.

It's like a Unit conversion, but adapted for each barcode.

I adapted Barcode Buddy to realize this !

supergeorg commented 2 years ago

You can always add different purchase units and conversions to the product. This could be a "bottle" and a "pack" type, which converts to different values.

But I am not sure if chained conversions are possible and supported (pack -> bottle -> ml). The logic you described seems to be a bit hard to implement in the app (this needs scripting capabilities or the like), so your case with custom fields would not work anyways. But maybe a different solution is possible.