diff --git a/changelog/55_UNRELEASED_2019-xx-xx.md b/changelog/55_UNRELEASED_2019-xx-xx.md index 7ba8f5c6..9027446c 100644 --- a/changelog/55_UNRELEASED_2019-xx-xx.md +++ b/changelog/55_UNRELEASED_2019-xx-xx.md @@ -6,6 +6,7 @@ ### Stock fixes - Fixed that entering partial amounts was not possible on the inventory page (only applies if the product option "Allow partial units in stock" is enabled) +- Fixed that on purchase a wrong minimum amount was enforced for products with enabled tare weight handling in combination with different purchase/stock quantity units ### Shopping list fixes - Fixed that when `FEATURE_FLAG_SHOPPINGLIST_MULTIPLE_LISTS` was set to `false`, the shopping list appeared empty after some actions diff --git a/public/viewjs/purchase.js b/public/viewjs/purchase.js index 26073c20..368264cc 100644 --- a/public/viewjs/purchase.js +++ b/public/viewjs/purchase.js @@ -160,8 +160,9 @@ if (Grocy.Components.ProductPicker !== undefined) if (productDetails.product.enable_tare_weight_handling == 1) { - var minAmount = parseFloat(productDetails.product.tare_weight) + parseFloat(productDetails.stock_amount) + 1; + var minAmount = parseFloat(productDetails.product.tare_weight) / productDetails.product.qu_factor_purchase_to_stock + parseFloat(productDetails.stock_amount); $("#amount").attr("min", minAmount); + $("#amount").attr("step", "0.0001"); $("#amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', minAmount.toLocaleString())); $("#tare-weight-handling-info").removeClass("d-none"); }