mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #1400 from eeintech/ipn_edit_setting
Add setting to disable IPN editing after part is created (web only)
This commit is contained in:
commit
e2e870858d
@ -97,6 +97,13 @@ class InvenTreeSetting(models.Model):
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'PART_ALLOW_EDIT_IPN': {
|
||||
'name': _('Allow Editing IPN'),
|
||||
'description': _('Allow changing the IPN value while editing a part'),
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'PART_COPY_BOM': {
|
||||
'name': _('Copy Part BOM Data'),
|
||||
'description': _('Copy BOM data by default when duplicating a part'),
|
||||
|
@ -910,6 +910,12 @@ class PartEdit(AjaxUpdateView):
|
||||
|
||||
form.fields['default_supplier'].queryset = SupplierPart.objects.filter(part=part)
|
||||
|
||||
# Check if IPN can be edited
|
||||
ipn_edit_enable = InvenTreeSetting.get_setting('PART_ALLOW_EDIT_IPN')
|
||||
if not ipn_edit_enable and not self.request.user.is_superuser:
|
||||
# Admin can still change IPN
|
||||
form.fields['IPN'].disabled = True
|
||||
|
||||
return form
|
||||
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
<tbody>
|
||||
{% include "InvenTree/settings/setting.html" with key="PART_IPN_REGEX" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="PART_ALLOW_DUPLICATE_IPN" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="PART_ALLOW_EDIT_IPN" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="PART_SHOW_QUANTITY_IN_FORMS" icon="fa-hashtag" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="PART_RECENT_COUNT" icon="fa-clock" %}
|
||||
<tr><td colspan='5 '></td></tr>
|
||||
|
Loading…
Reference in New Issue
Block a user