2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +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:
Oliver
2023-03-15 16:44:32 +11:00
committed by GitHub
parent 8d4ffcf682
commit 324a47ba17
4 changed files with 30 additions and 16 deletions

View File

@ -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" %}

View File

@ -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" %}',