Improve handling of not in-stock but valid manually entered products on the consume and transfer page (references #1429)

This commit is contained in:
Bernd Bestel
2021-07-09 22:16:08 +02:00
parent 72e6ed76bf
commit 2638bce851
5 changed files with 81 additions and 57 deletions

View File

@@ -419,20 +419,9 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
$("#tare-weight-handling-info").addClass("d-none");
}
if ((parseFloat(productDetails.stock_amount_aggregated) || 0) === 0)
{
Grocy.Components.ProductAmountPicker.Reset();
Grocy.Components.ProductPicker.Clear();
Grocy.FrontendHelpers.ValidateForm('consume-form');
Grocy.Components.ProductPicker.ShowCustomError(__t('This product is not in stock'));
Grocy.Components.ProductPicker.GetInputElement().focus();
}
else
{
Grocy.Components.ProductPicker.HideCustomError();
Grocy.FrontendHelpers.ValidateForm('consume-form');
$('#display_amount').focus();
}
Grocy.Components.ProductPicker.HideCustomError();
Grocy.FrontendHelpers.ValidateForm('consume-form');
$('#display_amount').focus();
if (productDetails.stock_amount == productDetails.stock_amount_opened || productDetails.product.enable_tare_weight_handling == 1)
{