mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 01:32:38 +00:00
Add amount to barcode created by the workflow InplaceAddBarcodeToExistingProduct on /purchase (closes #2085)
This commit is contained in:
parent
c934bfb7b3
commit
efae0b193d
@ -19,6 +19,7 @@
|
||||
- The product's "Quick consume amount" is now displayed related to this quantity unit ("quick consume/open buttons" on the stock overview page)
|
||||
- Defaults to the product's "Quantity unit stock" (so no changed behavior when not configured)
|
||||
- Changed that when the ingredient option "Only check if any amount is in stock" is enabled, costs and calories are now based on the original entered amount instead of an "virtual" fixed amount of `1`
|
||||
- When using the "Add as barcode to existing product" workflow on a purchase transaction, the selected quantity unit and the entered amount is now also added to the new barcode
|
||||
- Fixed that hiding the "Purchased date" column (table options) on the stock entries 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
|
||||
|
||||
|
@ -17,7 +17,7 @@ Grocy.Components.ProductAmountPicker.Reload = function(productId, destinationQuI
|
||||
|
||||
// Only conversions related to the destination QU are needed
|
||||
// + only add one conversion per to_qu_id (multiple ones can be a result of contradictory definitions = user input bullshit)
|
||||
if (conversion.from_qu_id == destinationQuId && !$('#qu_id option[value="' + conversion.to_qu_id + '"]').length)
|
||||
if ((conversion.from_qu_id == destinationQuId || conversion.to_qu_id == destinationQuId) && !$('#qu_id option[value="' + conversion.to_qu_id + '"]').length)
|
||||
{
|
||||
$("#qu_id").append('<option value="' + conversion.to_qu_id + '" data-qu-factor="' + factor + '" data-qu-name-plural="' + conversion.to_qu_name_plural + '">' + conversion.to_qu_name + '</option>');
|
||||
}
|
||||
|
@ -434,13 +434,13 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
|
||||
if (barcode != null)
|
||||
{
|
||||
if (barcode.amount != null && !barcode.amount.isEmpty())
|
||||
if (barcode.amount != null)
|
||||
{
|
||||
$("#display_amount").val(barcode.amount);
|
||||
$("#display_amount").select();
|
||||
}
|
||||
|
||||
if (barcode.qu_id != null && !barcode.qu_id.isEmpty())
|
||||
if (barcode.qu_id != null)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(barcode.qu_id);
|
||||
}
|
||||
|
@ -277,13 +277,13 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
|
||||
if (barcode != null)
|
||||
{
|
||||
if (barcode.amount != null && !barcode.amount.isEmpty())
|
||||
if (barcode.amount != null)
|
||||
{
|
||||
$("#display_amount").val(barcode.amount);
|
||||
$("#display_amount").select();
|
||||
}
|
||||
|
||||
if (barcode.qu_id != null && !barcode.qu_id.isEmpty())
|
||||
if (barcode.qu_id != null)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(barcode.qu_id);
|
||||
}
|
||||
|
@ -99,6 +99,8 @@ $('#save-purchase-button').on('click', function(e)
|
||||
jsonDataBarcode.barcode = GetUriParam("barcode");
|
||||
jsonDataBarcode.product_id = jsonForm.product_id;
|
||||
jsonDataBarcode.shopping_location_id = jsonForm.shopping_location_id;
|
||||
jsonDataBarcode.qu_id = jsonForm.qu_id;
|
||||
jsonDataBarcode.amount = jsonForm.display_amount;
|
||||
|
||||
Grocy.Api.Post('objects/product_barcodes', jsonDataBarcode,
|
||||
function(result)
|
||||
@ -361,13 +363,13 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||
|
||||
if (barcode != null)
|
||||
{
|
||||
if (barcode.amount != null && !barcode.amount.isEmpty())
|
||||
if (barcode.amount != null)
|
||||
{
|
||||
$("#display_amount").val(barcode.amount);
|
||||
$("#display_amount").select();
|
||||
}
|
||||
|
||||
if (barcode.qu_id != null && !barcode.qu_id.isEmpty())
|
||||
if (barcode.qu_id != null)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(barcode.qu_id);
|
||||
}
|
||||
|
@ -222,13 +222,13 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
|
||||
if (barcode != null)
|
||||
{
|
||||
if (barcode.amount != null && !barcode.amount.isEmpty())
|
||||
if (barcode.amount != null)
|
||||
{
|
||||
$("#display_amount").val(barcode.amount);
|
||||
$("#display_amount").select();
|
||||
}
|
||||
|
||||
if (barcode.qu_id != null && !barcode.qu_id.isEmpty())
|
||||
if (barcode.qu_id != null)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(barcode.qu_id);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user