Don't add the destination QU multiple time in productamountpicker

This commit is contained in:
Bernd Bestel
2020-11-10 21:19:51 +01:00
parent 4959e9e732
commit 7f600bd8d9

View File

@@ -17,7 +17,10 @@ Grocy.Components.ProductAmountPicker.Reload = function(productId, destinationQuI
factor = 1; factor = 1;
} }
if (!$('#qu_id option[value="' + conversion.to_qu_id + '"]').length) // Don't add the destination QU multiple times
{
$("#qu_id").append('<option value="' + conversion.to_qu_id + '" data-qu-factor="' + factor + '">' + conversion.to_qu_name + '</option>'); $("#qu_id").append('<option value="' + conversion.to_qu_id + '" data-qu-factor="' + factor + '">' + conversion.to_qu_name + '</option>');
}
}); });
} }