mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +00:00
Always allow move_on_open (closes #1983)
This commit is contained in:
parent
f1bc2cc40f
commit
e8dc334758
@ -9,6 +9,7 @@
|
|||||||
### Stock
|
### Stock
|
||||||
|
|
||||||
- Improved that when editing a unit conversion, the "Quantity unit from" and "Quantity unit to" of the corresponding inverse conversion is now also updated accordingly if changed (until now only the factor was updated automatically)
|
- Improved that when editing a unit conversion, the "Quantity unit from" and "Quantity unit to" of the corresponding inverse conversion is now also updated accordingly if changed (until now only the factor was updated automatically)
|
||||||
|
- Changed that the "Move on open" product option can now always be used/set, even when the "Default location" and "Default conume location" are the same
|
||||||
- Fixed that stock entry notes were lost when consuming/opening/transferring a partial amount of the corresponding stock entry (thanks @akoshpinter)
|
- Fixed that stock entry notes were lost when consuming/opening/transferring a partial amount of the corresponding stock entry (thanks @akoshpinter)
|
||||||
- Fixed that the average shelf life of a product (on the productcard) was wrong when the corresponding stock entry was edited
|
- Fixed that the average shelf life of a product (on the productcard) was wrong when the corresponding stock entry was edited
|
||||||
- Fixed that when the stock setting "Decimal places allowed for amounts" was set to `0`, unit conversion (if any) failed when adding the corresponding product to stock
|
- Fixed that when the stock setting "Decimal places allowed for amounts" was set to `0`, unit conversion (if any) failed when adding the corresponding product to stock
|
||||||
|
@ -189,7 +189,7 @@ $('#save-mark-as-open-button').on('click', function(e)
|
|||||||
Grocy.FrontendHelpers.EndUiBusy("consume-form");
|
Grocy.FrontendHelpers.EndUiBusy("consume-form");
|
||||||
toastr.success(__t('Marked %1$s of %2$s as opened', parseFloat(jsonForm.amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }) + " " + __n(jsonForm.amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural, true), productDetails.product.name) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockTransaction(\'' + result[0].transaction_id + '\')"><i class="fa-solid fa-undo"></i> ' + __t("Undo") + '</a>');
|
toastr.success(__t('Marked %1$s of %2$s as opened', parseFloat(jsonForm.amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }) + " " + __n(jsonForm.amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural, true), productDetails.product.name) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockTransaction(\'' + result[0].transaction_id + '\')"><i class="fa-solid fa-undo"></i> ' + __t("Undo") + '</a>');
|
||||||
|
|
||||||
if (productDetails.product.move_on_open == 1)
|
if (productDetails.product.move_on_open == 1 && productDetails.default_consume_location != null)
|
||||||
{
|
{
|
||||||
toastr.info('<span>' + __t("Moved to %1$s", productDetails.default_consume_location.name) + "</span> <i class='fa-solid fa-exchange-alt'></i>");
|
toastr.info('<span>' + __t("Moved to %1$s", productDetails.default_consume_location.name) + "</span> <i class='fa-solid fa-exchange-alt'></i>");
|
||||||
}
|
}
|
||||||
|
@ -239,30 +239,8 @@ $('#product-form input').keyup(function(event)
|
|||||||
$('#location_id').change(function(event)
|
$('#location_id').change(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('product-form');
|
Grocy.FrontendHelpers.ValidateForm('product-form');
|
||||||
UpdateMoveOnOpen();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#default_consume_location_id').change(function(event)
|
|
||||||
{
|
|
||||||
UpdateMoveOnOpen();
|
|
||||||
});
|
|
||||||
|
|
||||||
function UpdateMoveOnOpen()
|
|
||||||
{
|
|
||||||
var defaultLocation = $("#location_id :selected").val();
|
|
||||||
var consumeLocationLocation = $("#default_consume_location_id :selected").val();
|
|
||||||
|
|
||||||
if (!consumeLocationLocation || defaultLocation === consumeLocationLocation)
|
|
||||||
{
|
|
||||||
document.getElementById("move_on_open").checked = false;
|
|
||||||
$("#move_on_open").attr("disabled", true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$("#move_on_open").attr("disabled", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#product-form input').keydown(function(event)
|
$('#product-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) // Enter
|
if (event.keyCode === 13) // Enter
|
||||||
@ -578,7 +556,6 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
UpdateMoveOnOpen();
|
|
||||||
Grocy.FrontendHelpers.ValidateForm("product-form");
|
Grocy.FrontendHelpers.ValidateForm("product-form");
|
||||||
Grocy.Components.ProductPicker.GetPicker().trigger("change");
|
Grocy.Components.ProductPicker.GetPicker().trigger("change");
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ $(document).on('click', '.product-open-button', function(e)
|
|||||||
Grocy.FrontendHelpers.EndUiBusy();
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
toastr.success(__t('Marked %1$s of %2$s as opened', 1 + " " + productQuName, productName) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockBookingEntry(' + bookingResponse[0].id + ',' + stockRowId + ')"><i class="fa-solid fa-undo"></i> ' + __t("Undo") + '</a>');
|
toastr.success(__t('Marked %1$s of %2$s as opened', 1 + " " + productQuName, productName) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockBookingEntry(' + bookingResponse[0].id + ',' + stockRowId + ')"><i class="fa-solid fa-undo"></i> ' + __t("Undo") + '</a>');
|
||||||
|
|
||||||
if (result.product.move_on_open == 1)
|
if (result.product.move_on_open == 1 && result.default_consume_location != null)
|
||||||
{
|
{
|
||||||
toastr.info('<span>' + __t("Moved to %1$s", result.default_consume_location.name) + "</span> <i class='fa-solid fa-exchange-alt'></i>");
|
toastr.info('<span>' + __t("Moved to %1$s", result.default_consume_location.name) + "</span> <i class='fa-solid fa-exchange-alt'></i>");
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ $(document).on('click', '.product-open-button', function(e)
|
|||||||
Grocy.FrontendHelpers.EndUiBusy();
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
toastr.success(__t('Marked %1$s of %2$s as opened', parseFloat(amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }) + " " + productQuName, productName) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockTransaction(\'' + bookingResponse[0].transaction_id + '\')"><i class="fa-solid fa-undo"></i> ' + __t("Undo") + '</a>');
|
toastr.success(__t('Marked %1$s of %2$s as opened', parseFloat(amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }) + " " + productQuName, productName) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockTransaction(\'' + bookingResponse[0].transaction_id + '\')"><i class="fa-solid fa-undo"></i> ' + __t("Undo") + '</a>');
|
||||||
|
|
||||||
if (result.product.move_on_open == 1)
|
if (result.product.move_on_open == 1 && result.default_consume_location != null)
|
||||||
{
|
{
|
||||||
toastr.info('<span>' + __t("Moved to %1$s", result.default_consume_location.name) + "</span> <i class='fa-solid fa-exchange-alt'></i>");
|
toastr.info('<span>' + __t("Moved to %1$s", result.default_consume_location.name) + "</span> <i class='fa-solid fa-exchange-alt'></i>");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user