mirror of
https://github.com/grocy/grocy.git
synced 2025-10-15 01:37:13 +00:00
Fixed recipeposform edit when "Only check if a single unit is in stock" is set (again closes #535)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user