mirror of
https://github.com/grocy/grocy.git
synced 2025-08-18 11:27:03 +00:00
Use barcode amounts also for Consume/Transfer/Inventory (closes #1254)
This commit is contained in:
@@ -192,6 +192,41 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
}
|
||||
);
|
||||
|
||||
if (document.getElementById("product_id").getAttribute("barcode") != "null")
|
||||
{
|
||||
Grocy.Api.Get('objects/product_barcodes?query[]=barcode=' + document.getElementById("product_id").getAttribute("barcode"),
|
||||
function(barcodeResult)
|
||||
{
|
||||
if (barcodeResult != null)
|
||||
{
|
||||
var barcode = barcodeResult[0];
|
||||
|
||||
if (barcode != null)
|
||||
{
|
||||
if (barcode.amount != null && !barcode.amount.isEmpty())
|
||||
{
|
||||
$("#display_amount").val(barcode.amount);
|
||||
$("#display_amount").select();
|
||||
}
|
||||
|
||||
if (barcode.qu_id != null)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(barcode.qu_id);
|
||||
}
|
||||
|
||||
$(".input-group-productamountpicker").trigger("change");
|
||||
Grocy.FrontendHelpers.ValidateForm('transfer-form');
|
||||
RefreshLocaleNumberInput();
|
||||
}
|
||||
}
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (productDetails.product.enable_tare_weight_handling == 1)
|
||||
{
|
||||
$("#display_amount").attr("min", productDetails.product.tare_weight);
|
||||
|
Reference in New Issue
Block a user