diff --git a/localization/strings.pot b/localization/strings.pot
index 702ace96..6ce941ba 100644
--- a/localization/strings.pot
+++ b/localization/strings.pot
@@ -1864,7 +1864,7 @@ msgstr ""
msgid "This is due earlier than already in-stock items"
msgstr ""
-msgid "When enabled, the amount will always be filled with 1 after changing/scanning a product and if all fields could be automatically populated (by product defaults), the transaction is automatically submitted"
+msgid "When enabled, after changing/scanning a product and if all fields could be automatically populated (by product and/or barcode defaults), the transaction is automatically submitted"
msgstr ""
msgid "Quick consume amount"
diff --git a/public/viewjs/purchase.js b/public/viewjs/purchase.js
index 48000fb2..ba47ca7d 100644
--- a/public/viewjs/purchase.js
+++ b/public/viewjs/purchase.js
@@ -287,23 +287,6 @@ if (Grocy.Components.ProductPicker !== undefined)
$("#save-purchase-button").click();
}
- if (BoolVal(Grocy.UserSettings.scan_mode_purchase_enabled))
- {
- $("#display_amount").val(1);
- $(".input-group-productamountpicker").trigger("change");
-
- Grocy.FrontendHelpers.ValidateForm("purchase-form");
- if (document.getElementById("purchase-form").checkValidity() === true)
- {
- $('#save-purchase-button').click();
- }
- else
- {
- toastr.warning(__t("Scan mode is on but not all required fields could be populated automatically"));
- Grocy.UISound.Error();
- }
- }
-
RefreshLocaleNumberInput();
if (document.getElementById("product_id").getAttribute("barcode") != "null")
@@ -345,6 +328,8 @@ if (Grocy.Components.ProductPicker !== undefined)
RefreshLocaleNumberInput();
}
}
+
+ ScanModeSubmit(false);
},
function(xhr)
{
@@ -355,6 +340,7 @@ if (Grocy.Components.ProductPicker !== undefined)
else
{
$("#purchase-form").removeAttr("data-used-barcode");
+ ScanModeSubmit();
}
$('#display_amount').trigger("keyup");
@@ -588,3 +574,26 @@ $('#qu_id').on('change', function(e)
priceTypeUnitPriceLabel.text($("#qu_id option:selected").text() + " " + __t("price"));
refreshPriceHint();
});
+
+function ScanModeSubmit(singleUnit = true)
+{
+ if (BoolVal(Grocy.UserSettings.scan_mode_purchase_enabled))
+ {
+ if (singleUnit)
+ {
+ $("#display_amount").val(1);
+ $(".input-group-productamountpicker").trigger("change");
+ }
+
+ Grocy.FrontendHelpers.ValidateForm("purchase-form");
+ if (document.getElementById("purchase-form").checkValidity() === true)
+ {
+ $('#save-purchase-button').click();
+ }
+ else
+ {
+ toastr.warning(__t("Scan mode is on but not all required fields could be populated automatically"));
+ Grocy.UISound.Error();
+ }
+ }
+}
diff --git a/views/consume.blade.php b/views/consume.blade.php
index 1a6479eb..152afe24 100644
--- a/views/consume.blade.php
+++ b/views/consume.blade.php
@@ -31,7 +31,7 @@
+ title="{{ $__t('When enabled, after changing/scanning a product and if all fields could be automatically populated (by product and/or barcode defaults), the transaction is automatically submitted') }}">{{ $__t('Scan mode') }} @if(boolval($userSettings['scan_mode_consume_enabled'])) {{ $__t('on') }} @else {{ $__t('off') }} @endif
{{ $__t('Scan mode') }} @if(boolval($userSettings['scan_mode_purchase_enabled'])) {{ $__t('on') }} @else {{ $__t('off') }} @endif
+ title="{{ $__t('When enabled, after changing/scanning a product and if all fields could be automatically populated (by product and/or barcode defaults), the transaction is automatically submitted') }}">{{ $__t('Scan mode') }} @if(boolval($userSettings['scan_mode_purchase_enabled'])) {{ $__t('on') }} @else {{ $__t('off') }} @endif