Preset the stock qu with the purchase qu on new products. (#688)

This commit is contained in:
Mik- 2020-04-02 08:36:20 +02:00 committed by GitHub
parent 7200f2c17f
commit 1aa788b6c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;
}
});