mirror of
https://github.com/grocy/grocy.git
synced 2025-08-18 19:37:12 +00:00
Show purchase to stock conversion factor on purchase page when QU units are different (closes #169)
This commit is contained in:
@@ -105,10 +105,18 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
Grocy.Api.Get('stock/products/' + productId,
|
||||
function (productDetails)
|
||||
{
|
||||
$('#amount_qu_unit').text(productDetails.quantity_unit_purchase.name);
|
||||
$('#price').val(productDetails.last_price);
|
||||
Grocy.Components.LocationPicker.SetId(productDetails.location.id);
|
||||
|
||||
if (productDetails.product.qu_id_purchase === productDetails.product.qu_id_stock)
|
||||
{
|
||||
$('#amount_qu_unit').text(productDetails.quantity_unit_purchase.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#amount_qu_unit').text(productDetails.quantity_unit_purchase.name + " (" + L("will be multiplied a factor of #1 to get #2", parseInt(productDetails.product.qu_factor_purchase_to_stock).toString(), productDetails.quantity_unit_stock.name) + ")");
|
||||
}
|
||||
|
||||
if (productDetails.product.allow_partial_units_in_stock == 1)
|
||||
{
|
||||
$("#amount").attr("min", "0.01");
|
||||
|
Reference in New Issue
Block a user