mirror of
https://github.com/grocy/grocy.git
synced 2025-04-30 01:55:47 +00:00
Fixed recipe ingredient initial QU (fixes #1060)
This commit is contained in:
parent
758a8d9708
commit
235b96d17f
@ -1,4 +1,4 @@
|
|||||||
Grocy.RecipePosFormProductChangeCount = 0;
|
Grocy.RecipePosFormInitialLoadDone = false;
|
||||||
|
|
||||||
$('#save-recipe-pos-button').on('click', function(e)
|
$('#save-recipe-pos-button').on('click', function(e)
|
||||||
{
|
{
|
||||||
@ -53,9 +53,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
Grocy.Api.Get('stock/products/' + productId,
|
Grocy.Api.Get('stock/products/' + productId,
|
||||||
function(productDetails)
|
function(productDetails)
|
||||||
{
|
{
|
||||||
Grocy.RecipePosFormProductChangeCount++;
|
if (!Grocy.RecipePosFormInitialLoadDone)
|
||||||
|
|
||||||
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);
|
Grocy.Components.ProductAmountPicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id, true);
|
||||||
}
|
}
|
||||||
@ -82,13 +80,14 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
$("#not_check_stock_fulfillment").prop("checked", productDetails.product.not_check_stock_fulfillment_for_recipes == 1);
|
$("#not_check_stock_fulfillment").prop("checked", productDetails.product.not_check_stock_fulfillment_for_recipes == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$("#only_check_single_unit_in_stock").prop("checked"))
|
if (!$("#only_check_single_unit_in_stock").prop("checked") && Grocy.RecipePosFormInitialLoadDone)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.quantity_unit_stock.id);
|
Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.quantity_unit_stock.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#display_amount').focus();
|
$('#display_amount').focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm('recipe-pos-form');
|
Grocy.FrontendHelpers.ValidateForm('recipe-pos-form');
|
||||||
|
Grocy.RecipePosFormInitialLoadDone = true;
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
@ -106,6 +105,11 @@ if (Grocy.Components.ProductPicker.InProductAddWorkflow() === false)
|
|||||||
}
|
}
|
||||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||||
|
|
||||||
|
if (Grocy.EditMode == "create")
|
||||||
|
{
|
||||||
|
Grocy.RecipePosFormInitialLoadDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
$('#display_amount').on('focus', function(e)
|
$('#display_amount').on('focus', function(e)
|
||||||
{
|
{
|
||||||
if (Grocy.Components.ProductPicker.GetValue().length === 0)
|
if (Grocy.Components.ProductPicker.GetValue().length === 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user