Preset the stock qu with the purchase qu on new products.

This commit is contained in:
Michael Neuendorf 2020-04-01 21:32:10 +02:00
parent 746203b82d
commit 9bd10b1487

View File

@ -423,3 +423,13 @@ $("#qu-conversion-add-button").on("click", function(e)
Grocy.ProductEditFormRedirectUri = U("/quantityunitconversion/new?product=editobjectid");
$('#save-product-button').click();
});
$('#qu_id_purchase').blur(function(e)
{
// Preset the stock quantity unit with the purchase quantity unit, if the stock quantity unit is unset.
var QuIdStock = $('#qu_id_stock');
var QuIdPurchase = $('#qu_id_purchase');
if (QuIdStock[0].selectedIndex === 0 && QuIdPurchase[0].selectedIndex !== 0) {
QuIdStock[0].selectedIndex = QuIdPurchase[0].selectedIndex;
}
});