Settings to show import-button

This commit is contained in:
Matthias 2021-05-26 09:20:50 +02:00
parent 3c5bb048a1
commit 4319ba16af
3 changed files with 31 additions and 1 deletions

View File

@ -211,6 +211,13 @@ class InvenTreeSetting(models.Model):
'validator': bool,
},
'PART_SHOW_IMPORT': {
'name': _('Show Import in Views'),
'description': _('Display the import wizard in some part views'),
'default': False,
'validator': bool,
},
'REPORT_DEBUG_MODE': {
'name': _('Debug Mode'),
'description': _('Generate reports in debug mode (HTML output)'),

View File

@ -1,4 +1,7 @@
{% load i18n %}
{% load inventree_extras %}
{% settings_value 'PART_SHOW_IMPORT' as show_import %}
<ul class='list-group'>
@ -30,7 +33,7 @@
</a>
</li>
{% if user.is_staff and roles.part.add %}
{% if show_import and user.is_staff and roles.part.add %}
<li class='list-group-item {% if tab == "import" %}active{% endif %}' title='{% trans "Import Parts" %}'>
<a href='{% url "part-import" %}'>
<span class='fas fa-file-upload'></span>

View File

@ -37,6 +37,22 @@
</tbody>
</table>
<h4>{% trans "Part Import" %}</h4>
<button class='btn btn-success' id='import-part'>
<span class='fas fa-plus-circle'></span> {% trans "Import Part" %}
</button>
<table class='table table-striped table-condensed'>
{% include "InvenTree/settings/header.html" %}
<tbody>
{% include "InvenTree/settings/setting.html" with key="PART_SHOW_IMPORT" icon="fa-file-upload" %}
</tbody>
</table>
<h4>{% trans "Part Parameter Templates" %}</h4>
<div id='param-buttons'>
@ -121,4 +137,8 @@
});
});
$("#import-part").click(function() {
launchModalForm("{% url 'part-import' %}", {});
});
{% endblock %}