mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +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,
|
'validator': bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'PART_ENABLE_REVISION': {
|
||||||
|
'name': _('Part Revisions'),
|
||||||
|
'description': _('Enable revision field for Part'),
|
||||||
|
'validator': bool,
|
||||||
|
'default': True,
|
||||||
|
},
|
||||||
|
|
||||||
'PART_IPN_REGEX': {
|
'PART_IPN_REGEX': {
|
||||||
'name': _('IPN Regex'),
|
'name': _('IPN Regex'),
|
||||||
'description': _('Regular expression pattern for matching Part IPN')
|
'description': _('Regular expression pattern for matching Part IPN')
|
||||||
|
@ -273,7 +273,8 @@
|
|||||||
<td>{{ part.IPN }}{% include "clip.html"%}</td>
|
<td>{{ part.IPN }}{% include "clip.html"%}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if part.revision %}
|
{% settings_value "PART_ENABLE_REVISION" as show_revision %}
|
||||||
|
{% if show_revision and part.revision %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class='fas fa-code-branch'></span></td>
|
<td><span class='fas fa-code-branch'></span></td>
|
||||||
<td>{% trans "Revision" %}</td>
|
<td>{% trans "Revision" %}</td>
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
<table class='table table-striped table-condensed'>
|
<table class='table table-striped table-condensed'>
|
||||||
<tbody>
|
<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_IPN_REGEX" %}
|
||||||
{% include "InvenTree/settings/setting.html" with key="PART_ALLOW_DUPLICATE_IPN" %}
|
{% 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_ALLOW_EDIT_IPN" %}
|
||||||
|
@ -98,7 +98,9 @@ function partFields(options={}) {
|
|||||||
},
|
},
|
||||||
name: {},
|
name: {},
|
||||||
IPN: {},
|
IPN: {},
|
||||||
revision: {},
|
revision: {
|
||||||
|
icon: 'fa-code-branch',
|
||||||
|
},
|
||||||
description: {},
|
description: {},
|
||||||
variant_of: {},
|
variant_of: {},
|
||||||
keywords: {
|
keywords: {
|
||||||
@ -174,11 +176,16 @@ function partFields(options={}) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pop expiry field
|
// Pop 'expiry' field
|
||||||
if (!global_settings.STOCK_ENABLE_EXPIRY) {
|
if (!global_settings.STOCK_ENABLE_EXPIRY) {
|
||||||
delete fields['default_expiry'];
|
delete fields['default_expiry'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pop 'revision' field
|
||||||
|
if (!global_settings.PART_ENABLE_REVISION) {
|
||||||
|
delete fields['revision'];
|
||||||
|
}
|
||||||
|
|
||||||
if (options.create || options.duplicate) {
|
if (options.create || options.duplicate) {
|
||||||
|
|
||||||
// Add fields for creating initial supplier data
|
// Add fields for creating initial supplier data
|
||||||
@ -1113,19 +1120,7 @@ function loadPartVariantTable(table, partId, options={}) {
|
|||||||
formatter: function(value, row) {
|
formatter: function(value, row) {
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
var name = '';
|
var name = row.full_name || row.name;
|
||||||
|
|
||||||
if (row.IPN) {
|
|
||||||
name += row.IPN;
|
|
||||||
name += ' | ';
|
|
||||||
}
|
|
||||||
|
|
||||||
name += value;
|
|
||||||
|
|
||||||
if (row.revision) {
|
|
||||||
name += ' | ';
|
|
||||||
name += row.revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (row.is_template) {
|
if (row.is_template) {
|
||||||
name = '<i>' + name + '</i>';
|
name = '<i>' + name + '</i>';
|
||||||
@ -1165,6 +1160,8 @@ function loadPartVariantTable(table, partId, options={}) {
|
|||||||
{
|
{
|
||||||
field: 'revision',
|
field: 'revision',
|
||||||
title: '{% trans "Revision" %}',
|
title: '{% trans "Revision" %}',
|
||||||
|
switchable: global_settings.PART_ENABLE_REVISION,
|
||||||
|
visible: global_settings.PART_ENABLE_REVISION,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1890,6 +1887,14 @@ function loadPartTable(table, url, options={}) {
|
|||||||
sortable: !options.params.ordering
|
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({
|
columns.push({
|
||||||
field: 'description',
|
field: 'description',
|
||||||
title: '{% trans "Description" %}',
|
title: '{% trans "Description" %}',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user