diff --git a/localization/strings.pot b/localization/strings.pot
index 80120c36..93238a29 100644
--- a/localization/strings.pot
+++ b/localization/strings.pot
@@ -2326,3 +2326,10 @@ msgstr ""
msgid "Stock entries at this location will be consumed first"
msgstr ""
+
+msgid "Move on open"
+msgstr ""
+
+
+msgid "When checked, opening the product will move one unit to the default consume location"
+msgstr ""
diff --git a/migrations/0189.sql b/migrations/0189.sql
new file mode 100644
index 00000000..04336994
--- /dev/null
+++ b/migrations/0189.sql
@@ -0,0 +1,2 @@
+ALTER TABLE products
+ADD move_on_open TINYINT NOT NULL DEFAULT 0 CHECK(move_on_open IN (0, 1));
diff --git a/public/viewjs/consume.js b/public/viewjs/consume.js
index 6bb6adbf..82d96df7 100644
--- a/public/viewjs/consume.js
+++ b/public/viewjs/consume.js
@@ -373,9 +373,11 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
$(".input-group-productamountpicker").trigger("change");
var defaultLocationId = productDetails.location.id;
- if (productDetails.product.default_consume_location_id != null && !productDetails.product.default_consume_location_id.isEmpty())
+ var defaultConsumeLocationId = productDetails.product.default_consume_location_id;
+
+ if (defaultConsumeLocationId != null && !defaultConsumeLocationId.isEmpty())
{
- defaultLocationId = productDetails.product.default_consume_location_id;
+ defaultLocationId = defaultConsumeLocationId;
}
$("#location_id").find("option").remove().end().append("");
@@ -386,26 +388,22 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
var stockAmountAtDefaultLocation = 0;
stockLocations.forEach(stockLocation =>
{
- if (stockLocation.location_id == defaultLocationId)
- {
- $("#location_id").append($("
@endforeach
+ @if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING)
+
+ move_on_open == 1) checked @endif class="form-check-input custom-control-input" type="checkbox" id="move_on_open" name="move_on_open" value="1">
+
+
+ @endif
@else