mirror of
https://github.com/grocy/grocy.git
synced 2025-04-30 01:55:47 +00:00
Prefill barcode note on /purchase and /inventory (closes #2193)
This commit is contained in:
parent
84bd74a1bc
commit
f4874ed8d0
@ -32,6 +32,7 @@
|
|||||||
- Changed that for the product's average and last price (and for the price history chart) stock transactions with an empty or `0` price are ignored
|
- Changed that for the product's average and last price (and for the price history chart) stock transactions with an empty or `0` price are ignored
|
||||||
- Added a filter option to only show currently out-of-stock products on the products list (master data) page
|
- Added a filter option to only show currently out-of-stock products on the products list (master data) page
|
||||||
- When clicking the product name on the products list (master data) page, the product card will now be displayed (like on the stock overview page)
|
- When clicking the product name on the products list (master data) page, the product card will now be displayed (like on the stock overview page)
|
||||||
|
- When using/scanning a product barcode and the purchase or inventory page, the barcode's note will now also be prefilled (if any)
|
||||||
- Fixed that hiding the "Purchased date" column (table options) on the stock entries page didn't work
|
- Fixed that hiding the "Purchased date" column (table options) on the stock entries page didn't work
|
||||||
- Fixed that sorting by the "Value" and "Min. stock amount" columns on the stock overview page didn't work
|
- Fixed that sorting by the "Value" and "Min. stock amount" columns on the stock overview page didn't work
|
||||||
- Fixed that the consumed amount was wrong, when consuming multiple substituted subproducts at once and when multiple/different conversion factors were involved
|
- Fixed that the consumed amount was wrong, when consuming multiple substituted subproducts at once and when multiple/different conversion factors were involved
|
||||||
|
@ -272,23 +272,28 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
Grocy.Api.Get('objects/product_barcodes?query[]=barcode=' + document.getElementById("product_id").getAttribute("barcode"),
|
Grocy.Api.Get('objects/product_barcodes?query[]=barcode=' + document.getElementById("product_id").getAttribute("barcode"),
|
||||||
function(barcodeResult)
|
function(barcodeResult)
|
||||||
{
|
{
|
||||||
if (barcodeResult != null)
|
if (barcodeResult)
|
||||||
{
|
{
|
||||||
var barcode = barcodeResult[0];
|
var barcode = barcodeResult[0];
|
||||||
|
|
||||||
if (barcode != null)
|
if (barcode)
|
||||||
{
|
{
|
||||||
if (barcode.amount != null)
|
if (barcode.amount)
|
||||||
{
|
{
|
||||||
$("#display_amount").val(barcode.amount);
|
$("#display_amount").val(barcode.amount);
|
||||||
$("#display_amount").select();
|
$("#display_amount").select();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (barcode.qu_id != null)
|
if (barcode.qu_id)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(barcode.qu_id);
|
Grocy.Components.ProductAmountPicker.SetQuantityUnit(barcode.qu_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (barcode.note)
|
||||||
|
{
|
||||||
|
$("#note").val(barcode.note);
|
||||||
|
}
|
||||||
|
|
||||||
$(".input-group-productamountpicker").trigger("change");
|
$(".input-group-productamountpicker").trigger("change");
|
||||||
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
||||||
RefreshLocaleNumberInput();
|
RefreshLocaleNumberInput();
|
||||||
|
@ -357,20 +357,20 @@ if (Grocy.Components.ProductPicker !== undefined)
|
|||||||
Grocy.Api.Get('objects/product_barcodes?query[]=barcode=' + document.getElementById("product_id").getAttribute("barcode"),
|
Grocy.Api.Get('objects/product_barcodes?query[]=barcode=' + document.getElementById("product_id").getAttribute("barcode"),
|
||||||
function(barcodeResult)
|
function(barcodeResult)
|
||||||
{
|
{
|
||||||
if (barcodeResult != null)
|
if (barcodeResult)
|
||||||
{
|
{
|
||||||
var barcode = barcodeResult[0];
|
var barcode = barcodeResult[0];
|
||||||
$("#purchase-form").attr("data-used-barcode", barcode.id);
|
$("#purchase-form").attr("data-used-barcode", barcode.id);
|
||||||
|
|
||||||
if (barcode != null)
|
if (barcode)
|
||||||
{
|
{
|
||||||
if (barcode.amount != null)
|
if (barcode.amount)
|
||||||
{
|
{
|
||||||
$("#display_amount").val(barcode.amount);
|
$("#display_amount").val(barcode.amount);
|
||||||
$("#display_amount").select();
|
$("#display_amount").select();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (barcode.qu_id != null)
|
if (barcode.qu_id)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(barcode.qu_id);
|
Grocy.Components.ProductAmountPicker.SetQuantityUnit(barcode.qu_id);
|
||||||
}
|
}
|
||||||
@ -386,6 +386,11 @@ if (Grocy.Components.ProductPicker !== undefined)
|
|||||||
$("#price-type-total-price").click();
|
$("#price-type-total-price").click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (barcode.note)
|
||||||
|
{
|
||||||
|
$("#note").val(barcode.note);
|
||||||
|
}
|
||||||
|
|
||||||
$(".input-group-productamountpicker").trigger("change");
|
$(".input-group-productamountpicker").trigger("change");
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||||
RefreshLocaleNumberInput();
|
RefreshLocaleNumberInput();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user