mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Optionally hide 'revision' field (#4493)
* Adds setting to enable / disable revision field * Optionally hide revision field from part forms * Hide revision informatoin on part page * Bug fix for part variant table - Use existing full_name variable rather than re-creating on the client side * Optionally hide 'revision' field in part tables
This commit is contained in:
parent
8d4ffcf682
commit
324a47ba17
@ -1071,6 +1071,13 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'PART_ENABLE_REVISION': {
|
||||
'name': _('Part Revisions'),
|
||||
'description': _('Enable revision field for Part'),
|
||||
'validator': bool,
|
||||
'default': True,
|
||||
},
|
||||
|
||||
'PART_IPN_REGEX': {
|
||||
'name': _('IPN Regex'),
|
||||
'description': _('Regular expression pattern for matching Part IPN')
|
||||
|
@ -273,7 +273,8 @@
|
||||
<td>{{ part.IPN }}{% include "clip.html"%}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if part.revision %}
|
||||
{% settings_value "PART_ENABLE_REVISION" as show_revision %}
|
||||
{% if show_revision and part.revision %}
|
||||
<tr>
|
||||
<td><span class='fas fa-code-branch'></span></td>
|
||||
<td>{% trans "Revision" %}</td>
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
<table class='table table-striped table-condensed'>
|
||||
<tbody>
|
||||
{% include "InvenTree/settings/setting.html" with key="PART_ENABLE_REVISION" %}
|
||||
{% 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" %}
|
||||
|
@ -98,7 +98,9 @@ function partFields(options={}) {
|
||||
},
|
||||
name: {},
|
||||
IPN: {},
|
||||
revision: {},
|
||||
revision: {
|
||||
icon: 'fa-code-branch',
|
||||
},
|
||||
description: {},
|
||||
variant_of: {},
|
||||
keywords: {
|
||||
@ -174,11 +176,16 @@ function partFields(options={}) {
|
||||
};
|
||||
}
|
||||
|
||||
// Pop expiry field
|
||||
// Pop 'expiry' field
|
||||
if (!global_settings.STOCK_ENABLE_EXPIRY) {
|
||||
delete fields['default_expiry'];
|
||||
}
|
||||
|
||||
// Pop 'revision' field
|
||||
if (!global_settings.PART_ENABLE_REVISION) {
|
||||
delete fields['revision'];
|
||||
}
|
||||
|
||||
if (options.create || options.duplicate) {
|
||||
|
||||
// Add fields for creating initial supplier data
|
||||
@ -1113,19 +1120,7 @@ function loadPartVariantTable(table, partId, options={}) {
|
||||
formatter: function(value, row) {
|
||||
var html = '';
|
||||
|
||||
var name = '';
|
||||
|
||||
if (row.IPN) {
|
||||
name += row.IPN;
|
||||
name += ' | ';
|
||||
}
|
||||
|
||||
name += value;
|
||||
|
||||
if (row.revision) {
|
||||
name += ' | ';
|
||||
name += row.revision;
|
||||
}
|
||||
var name = row.full_name || row.name;
|
||||
|
||||
if (row.is_template) {
|
||||
name = '<i>' + name + '</i>';
|
||||
@ -1165,6 +1160,8 @@ function loadPartVariantTable(table, partId, options={}) {
|
||||
{
|
||||
field: 'revision',
|
||||
title: '{% trans "Revision" %}',
|
||||
switchable: global_settings.PART_ENABLE_REVISION,
|
||||
visible: global_settings.PART_ENABLE_REVISION,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
@ -1890,6 +1887,14 @@ function loadPartTable(table, url, options={}) {
|
||||
sortable: !options.params.ordering
|
||||
});
|
||||
|
||||
columns.push({
|
||||
field: 'revision',
|
||||
title: '{% trans "Revision" %}',
|
||||
switchable: global_settings.PART_ENABLE_REVISION,
|
||||
visible: global_settings.PART_ENABLE_REVISION,
|
||||
sortable: true,
|
||||
});
|
||||
|
||||
columns.push({
|
||||
field: 'description',
|
||||
title: '{% trans "Description" %}',
|
||||
|
Loading…
Reference in New Issue
Block a user