Enforce stock QU on /purchase for tare weight handling enabled products (fixes #1795)

This commit is contained in:
Bernd Bestel 2022-02-20 19:33:55 +01:00
parent 5bfdddd52b
commit a027077211
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300

View File

@ -253,7 +253,15 @@ if (Grocy.Components.ProductPicker !== undefined)
CurrentProductDetails = productDetails;
Grocy.Components.ProductAmountPicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
if (productDetails.product.enable_tare_weight_handling == 1)
{
Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.quantity_unit_stock.id);
$("#qu_id").attr("disabled", "");
}
else
{
Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.default_quantity_unit_purchase.id);
}
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_purchase_amount));
$(".input-group-productamountpicker").trigger("change");