diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py
index 36ac62bf40..60b9df5ebf 100644
--- a/InvenTree/common/models.py
+++ b/InvenTree/common/models.py
@@ -1215,6 +1215,13 @@ class InvenTreeSetting(BaseInvenTreeSetting):
'validator': bool,
},
+ 'SERIAL_NUMBER_AUTOFILL': {
+ 'name': _('Autofill Serial Numbers'),
+ 'description': _('Autofill serial numbers in forms'),
+ 'default': False,
+ 'validator': bool,
+ },
+
'STOCK_BATCH_CODE_TEMPLATE': {
'name': _('Batch Code Template'),
'description': _('Template for generating default batch codes for stock items'),
diff --git a/InvenTree/templates/InvenTree/settings/stock.html b/InvenTree/templates/InvenTree/settings/stock.html
index 2f6c92c7d4..f45bf16e3c 100644
--- a/InvenTree/templates/InvenTree/settings/stock.html
+++ b/InvenTree/templates/InvenTree/settings/stock.html
@@ -12,6 +12,7 @@
{% include "InvenTree/settings/setting.html" with key="SERIAL_NUMBER_GLOBALLY_UNIQUE" icon="fa-hashtag" %}
+ {% include "InvenTree/settings/setting.html" with key="SERIAL_NUMBER_AUTOFILL" icon="fa-magic" %}
{% include "InvenTree/settings/setting.html" with key="STOCK_BATCH_CODE_TEMPLATE" icon="fa-layer-group" %}
{% include "InvenTree/settings/setting.html" with key="STOCK_ENABLE_EXPIRY" icon="fa-stopwatch" %}
{% include "InvenTree/settings/setting.html" with key="STOCK_STALE_DAYS" icon="fa-calendar" %}
diff --git a/InvenTree/templates/js/translated/stock.js b/InvenTree/templates/js/translated/stock.js
index 76d6f3ec5f..fa1c6e7944 100644
--- a/InvenTree/templates/js/translated/stock.js
+++ b/InvenTree/templates/js/translated/stock.js
@@ -240,6 +240,12 @@ function stockItemFields(options={}) {
}
setFormInputPlaceholder('serial_numbers', placeholder, opts);
+
+ if (global_settings.SERIAL_NUMBER_AUTOFILL) {
+ if (data.next) {
+ updateFieldValue('serial_numbers', `${data.next}+`, {}, opts);
+ }
+ }
}
});