Fixed recipeposform edit when "Only check if a single unit is in stock" is set (again closes #535)

This commit is contained in:
Bernd Bestel
2020-02-02 12:33:48 +01:00
parent 7235d9c0c9
commit 5effa0c103
3 changed files with 19 additions and 13 deletions

View File

@@ -55,7 +55,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
{
Grocy.RecipePosFormProductChangeCount++;
if (Grocy.RecipePosFormProductChangeCount < 3) // This triggers twice on inital page load, however
if (Grocy.RecipePosFormProductChangeCount < 3) // This triggers twice on initial page load, however
{
Grocy.Components.ProductAmountPicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id, true);
}
@@ -139,7 +139,7 @@ $("#only_check_single_unit_in_stock").on("click", function()
$("#display_amount").attr("min", "0.01");
$("#display_amount").attr("step", "0.01");
$("#display_amount").parent().find(".invalid-feedback").text(__t("This cannot be negative"));
Grocy.Components.ProductAmountPicker.AllowAnyQu();
Grocy.Components.ProductAmountPicker.AllowAnyQu(true);
Grocy.FrontendHelpers.ValidateForm("recipe-pos-form");
}
else
@@ -153,6 +153,7 @@ $("#only_check_single_unit_in_stock").on("click", function()
}
});
// Click twice to trigger on-click but not change the actual checked state
$("#only_check_single_unit_in_stock").click();
$("#only_check_single_unit_in_stock").click();
if ($("#only_check_single_unit_in_stock").prop("checked"))
{
Grocy.Components.ProductAmountPicker.AllowAnyQu(true);
}