diff --git a/changelog/47_UNRELEASED_xxxx-xx-xx.md b/changelog/47_UNRELEASED_xxxx-xx-xx.md
index 696c54e9..dea705e1 100644
--- a/changelog/47_UNRELEASED_xxxx-xx-xx.md
+++ b/changelog/47_UNRELEASED_xxxx-xx-xx.md
@@ -11,6 +11,7 @@
- Automations still use the default shopping list and also the default shopping list cannot be deleted
- More information on the product card like "Spoil rate" or "Average shelf life"
- It's now possible to set a price for added products during inventory
+ - It's now possible to customize the default amount for purchase/consume (see stock settings under the settings icon on the top right)
- Chores improvements
- New recurrence patterns - chores can now also be "scheduled" to repat daily/weekly/monthly
- New translations: (thanks all the translators)
diff --git a/config-dist.php b/config-dist.php
index 0c5d281c..2b3f2c4b 100644
--- a/config-dist.php
+++ b/config-dist.php
@@ -61,6 +61,8 @@ DefaultUserSetting('product_presets_location_id', -1); // Default location id fo
DefaultUserSetting('product_presets_product_group_id', -1); // Default product group id for new products (-1 means no product group is preset)
DefaultUserSetting('product_presets_qu_id', -1); // Default quantity unit id for new products (-1 means no quantity unit is preset)
DefaultUserSetting('stock_expring_soon_days', 5);
+DefaultUserSetting('stock_default_purchase_amount', 0);
+DefaultUserSetting('stock_default_consume_amount', 1);
# Chores settings
DefaultUserSetting('chores_due_soon_days', 5);
diff --git a/localization/strings.pot b/localization/strings.pot
index f09bb615..6afca128 100644
--- a/localization/strings.pot
+++ b/localization/strings.pot
@@ -1212,3 +1212,12 @@ msgstr ""
msgid "Not enough in stock"
msgstr ""
+
+msgid "Expiring soon days"
+msgstr ""
+
+msgid "Default amount for purchase"
+msgstr ""
+
+msgid "Default amount for consume"
+msgstr ""
diff --git a/public/viewjs/consume.js b/public/viewjs/consume.js
index 2203415e..3649a80e 100644
--- a/public/viewjs/consume.js
+++ b/public/viewjs/consume.js
@@ -72,7 +72,7 @@
$("#amount").attr("max", "999999");
$("#amount").attr("step", "1");
$("#amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', '1'));
- $('#amount').val(1);
+ $('#amount').val(Grocy.UserSettings.stock_default_consume_amount);
$('#amount_qu_unit').text("");
$("#tare-weight-handling-info").addClass("d-none");
Grocy.Components.ProductPicker.Clear();
@@ -135,7 +135,7 @@ $('#save-mark-as-open-button').on('click', function(e)
Grocy.FrontendHelpers.EndUiBusy("consume-form");
toastr.success(__t('Marked %s %s of %s as opened', jsonForm.amount, __n(jsonForm.amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural), productDetails.product.name) + '
' + __t("Undo") + '');
- $('#amount').val(1);
+ $('#amount').val(Grocy.UserSettings.stock_default_consume_amount);
Grocy.Components.ProductPicker.Clear();
Grocy.Components.ProductPicker.GetInputElement().focus();
Grocy.FrontendHelpers.ValidateForm('consume-form');
@@ -257,7 +257,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
}
});
-$('#amount').val(1);
+$('#amount').val(Grocy.UserSettings.stock_default_consume_amount);
Grocy.Components.ProductPicker.GetInputElement().focus();
Grocy.FrontendHelpers.ValidateForm('consume-form');
diff --git a/public/viewjs/purchase.js b/public/viewjs/purchase.js
index e5943e50..fb96c539 100644
--- a/public/viewjs/purchase.js
+++ b/public/viewjs/purchase.js
@@ -69,7 +69,7 @@
$("#amount").attr("min", "1");
$("#amount").attr("step", "1");
$("#amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', '1'));
- $('#amount').val(0);
+ $('#amount').val(Grocy.UserSettings.stock_default_purchase_amount);
$('#price').val('');
$('#amount_qu_unit').text("");
$("#tare-weight-handling-info").addClass("d-none");
@@ -177,7 +177,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
}
});
-$('#amount').val(0);
+$('#amount').val(Grocy.UserSettings.stock_default_purchase_amount);
Grocy.FrontendHelpers.ValidateForm('purchase-form');
if (Grocy.Components.ProductPicker.InProductAddWorkflow() === false)
diff --git a/public/viewjs/stocksettings.js b/public/viewjs/stocksettings.js
index f09080c4..2a963e3e 100644
--- a/public/viewjs/stocksettings.js
+++ b/public/viewjs/stocksettings.js
@@ -2,6 +2,8 @@
$("#product_presets_product_group_id").val(Grocy.UserSettings.product_presets_product_group_id);
$("#product_presets_qu_id").val(Grocy.UserSettings.product_presets_qu_id);
$("#stock_expring_soon_days").val(Grocy.UserSettings.stock_expring_soon_days);
+$("#stock_default_purchase_amount").val(Grocy.UserSettings.stock_default_purchase_amount);
+$("#stock_default_consume_amount").val(Grocy.UserSettings.stock_default_consume_amount);
if (BoolVal(Grocy.UserSettings.shopping_list_to_stock_workflow_auto_submit_when_prefilled))
{
diff --git a/views/stocksettings.blade.php b/views/stocksettings.blade.php
index 1c823e8e..6ec85b72 100644
--- a/views/stocksettings.blade.php
+++ b/views/stocksettings.blade.php
@@ -53,6 +53,26 @@
'additionalCssClasses' => 'user-setting-control'
))
+