mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Serial number autofill (#4091)
* Add global setting to control seiral number auto-fill * Auto fill serial number field
This commit is contained in:
parent
d4341e81f2
commit
17b0399d26
@ -1215,6 +1215,13 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
|||||||
'validator': bool,
|
'validator': bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'SERIAL_NUMBER_AUTOFILL': {
|
||||||
|
'name': _('Autofill Serial Numbers'),
|
||||||
|
'description': _('Autofill serial numbers in forms'),
|
||||||
|
'default': False,
|
||||||
|
'validator': bool,
|
||||||
|
},
|
||||||
|
|
||||||
'STOCK_BATCH_CODE_TEMPLATE': {
|
'STOCK_BATCH_CODE_TEMPLATE': {
|
||||||
'name': _('Batch Code Template'),
|
'name': _('Batch Code Template'),
|
||||||
'description': _('Template for generating default batch codes for stock items'),
|
'description': _('Template for generating default batch codes for stock items'),
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
<table class='table table-striped table-condensed'>
|
<table class='table table-striped table-condensed'>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% include "InvenTree/settings/setting.html" with key="SERIAL_NUMBER_GLOBALLY_UNIQUE" icon="fa-hashtag" %}
|
{% 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_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_ENABLE_EXPIRY" icon="fa-stopwatch" %}
|
||||||
{% include "InvenTree/settings/setting.html" with key="STOCK_STALE_DAYS" icon="fa-calendar" %}
|
{% include "InvenTree/settings/setting.html" with key="STOCK_STALE_DAYS" icon="fa-calendar" %}
|
||||||
|
@ -240,6 +240,12 @@ function stockItemFields(options={}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setFormInputPlaceholder('serial_numbers', placeholder, opts);
|
setFormInputPlaceholder('serial_numbers', placeholder, opts);
|
||||||
|
|
||||||
|
if (global_settings.SERIAL_NUMBER_AUTOFILL) {
|
||||||
|
if (data.next) {
|
||||||
|
updateFieldValue('serial_numbers', `${data.next}+`, {}, opts);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user