option to hide related parts #1733

This commit is contained in:
Matthias 2021-06-29 12:33:54 +02:00
parent 4eef3c99bc
commit d10169932d
3 changed files with 11 additions and 0 deletions

View File

@ -219,6 +219,13 @@ class InvenTreeSetting(models.Model):
'validator': bool, 'validator': bool,
}, },
'PART_SHOW_RELATED': {
'name': _('Show related parts'),
'description': _('Display related parts for a part'),
'default': True,
'validator': bool,
},
'PART_INTERNAL_PRICE': { 'PART_INTERNAL_PRICE': {
'name': _('Internal Prices'), 'name': _('Internal Prices'),
'description': _('Enable internal prices for parts'), 'description': _('Enable internal prices for parts'),

View File

@ -3,6 +3,7 @@
{% load inventree_extras %} {% load inventree_extras %}
{% settings_value "PART_INTERNAL_PRICE" as show_internal_price %} {% settings_value "PART_INTERNAL_PRICE" as show_internal_price %}
{% settings_value 'PART_SHOW_RELATED' as show_related %}
<ul class='list-group'> <ul class='list-group'>
<li class='list-group-item'> <li class='list-group-item'>
@ -124,12 +125,14 @@
</a> </a>
</li> </li>
{% endif %} {% endif %}
{% if show_related %}
<li class='list-group-item {% if tab == "related" %}active{% endif %}' title='{% trans "Related Parts" %}'> <li class='list-group-item {% if tab == "related" %}active{% endif %}' title='{% trans "Related Parts" %}'>
<a href='{% url "part-related" part.id %}'> <a href='{% url "part-related" part.id %}'>
<span class='menu-tab-icon fas fa-random sidebar-icon'></span> <span class='menu-tab-icon fas fa-random sidebar-icon'></span>
{% trans "Related Parts" %} {% trans "Related Parts" %}
</a> </a>
</li> </li>
{% endif %}
<li class='list-group-item {% if tab == "attachments" %}active{% endif %}' title='{% trans "Attachments" %}'> <li class='list-group-item {% if tab == "attachments" %}active{% endif %}' title='{% trans "Attachments" %}'>
<a href='{% url "part-attachments" part.id %}'> <a href='{% url "part-attachments" part.id %}'>
<span class='menu-tab-icon fas fa-paperclip sidebar-icon'></span> <span class='menu-tab-icon fas fa-paperclip sidebar-icon'></span>

View File

@ -21,6 +21,7 @@
{% include "InvenTree/settings/setting.html" with key="PART_ALLOW_EDIT_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_SHOW_QUANTITY_IN_FORMS" icon="fa-hashtag" %}
{% include "InvenTree/settings/setting.html" with key="PART_SHOW_PRICE_IN_FORMS" icon="fa-dollar-sign" %} {% include "InvenTree/settings/setting.html" with key="PART_SHOW_PRICE_IN_FORMS" icon="fa-dollar-sign" %}
{% include "InvenTree/settings/setting.html" with key="PART_SHOW_RELATED" icon="fa-random" %}
{% include "InvenTree/settings/setting.html" with key="PART_RECENT_COUNT" icon="fa-clock" %} {% include "InvenTree/settings/setting.html" with key="PART_RECENT_COUNT" icon="fa-clock" %}
<tr><td colspan='5 '></td></tr> <tr><td colspan='5 '></td></tr>
{% include "InvenTree/settings/setting.html" with key="PART_TEMPLATE" icon="fa-clone" %} {% include "InvenTree/settings/setting.html" with key="PART_TEMPLATE" icon="fa-clone" %}