mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Prefill specific stock entry information by a scanned stock entry Grocycode on /transfer (closes #2481)
This commit is contained in:
parent
88d0d32ea0
commit
6a68e410e4
@ -14,6 +14,7 @@
|
|||||||
- This executes the configured barcode lookup plugin with the given barcode
|
- This executes the configured barcode lookup plugin with the given barcode
|
||||||
- If the lookup was successful, the product edit page of the created product is displayed, where the product setup can be completed (if required)
|
- If the lookup was successful, the product edit page of the created product is displayed, where the product setup can be completed (if required)
|
||||||
- After that, the transaction is continued with that product
|
- After that, the transaction is continued with that product
|
||||||
|
- When using/scanning a stock entry Grocycode on the transfer page, the "Use specific stock item" dropdown (and "From location") is now also prefilled accordingly
|
||||||
- Fixed that for the product's last price stock transactions with an empty or `0` price weren't ignored
|
- Fixed that for the product's last price stock transactions with an empty or `0` price weren't ignored
|
||||||
- Fixed that when copying a product, the field "Move on open" wasn't copied along
|
- Fixed that when copying a product, the field "Move on open" wasn't copied along
|
||||||
|
|
||||||
|
@ -246,6 +246,25 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If a stock entry Grocycode was used, prefill location_from accordingly
|
||||||
|
if ($("#product_id").data("grocycode"))
|
||||||
|
{
|
||||||
|
var gc = $("#product_id").attr("barcode").split(":");
|
||||||
|
if (gc.length == 4)
|
||||||
|
{
|
||||||
|
Grocy.Api.Get("objects/stock?query[]=stock_id=" + gc[3],
|
||||||
|
function(stockEntries)
|
||||||
|
{
|
||||||
|
$("#location_id_from").val(stockEntries[0].location_id);
|
||||||
|
},
|
||||||
|
function(xhr)
|
||||||
|
{
|
||||||
|
console.error(xhr);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (productDetails.product.enable_tare_weight_handling == 1)
|
if (productDetails.product.enable_tare_weight_handling == 1)
|
||||||
{
|
{
|
||||||
$("#display_amount").attr("min", productDetails.product.tare_weight);
|
$("#display_amount").attr("min", productDetails.product.tare_weight);
|
||||||
@ -292,8 +311,18 @@ $("#location_id_from").on('change', function(e)
|
|||||||
stockId = GetUriParam('stockId');
|
stockId = GetUriParam('stockId');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If a stock entry Grocycode was used, preselect that one
|
||||||
|
if ($("#product_id").data("grocycode"))
|
||||||
|
{
|
||||||
|
var gc = $("#product_id").attr("barcode").split(":");
|
||||||
|
if (gc.length == 4)
|
||||||
|
{
|
||||||
|
stockId = gc[3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$("#specific_stock_entry").find("option").remove().end().append("<option></option>");
|
$("#specific_stock_entry").find("option").remove().end().append("<option></option>");
|
||||||
if ($("#use_specific_stock_entry").is(":checked") && GetUriParam("stockId") == null)
|
if (!$("#use_specific_stock_entry").is(":checked") && stockId != null)
|
||||||
{
|
{
|
||||||
$("#use_specific_stock_entry").click();
|
$("#use_specific_stock_entry").click();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user