mirror of
https://github.com/inventree/InvenTree.git
synced 2025-08-03 02:21:34 +00:00
Improvements for global settings
- Name and description are defined in models.py - Lookup functions for name / description / units / default - Shortcut template for rending settings - More unit testing
This commit is contained in:
InvenTree
common
part
templatetags
templates
@@ -15,17 +15,8 @@
|
||||
<table class='table table-striped table-condensed'>
|
||||
<thead></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{% trans "Reference Prefix" %}</th>
|
||||
<th>{% inventree_setting 'BUILDORDER_REFERENCE_PREFIX' backup='BO' %}</th>
|
||||
<td>{% trans "Prefix for Build Order reference" %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{% trans "Reference Regex" %}</th>
|
||||
<th>{% inventree_setting 'BUILDORDER_REFERENCE_REGEX' %}</th>
|
||||
<td>{% trans "Regex validator for Build Order reference" %}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{% include "InvenTree/settings/setting.html" with key="BUILDORDER_REFERENCE_PREFIX" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="BUILDORDER_REFERENCE_REGEX" %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@@ -11,6 +11,16 @@
|
||||
|
||||
{% block settings %}
|
||||
|
||||
<table class='table table-striped table-condensed'>
|
||||
<thead></thead>
|
||||
<tbody>
|
||||
{% include "InvenTree/settings/setting.html" with key="PART_IPN_REGEX" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="PART_COPY_BOM" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="PART_COPY_PARAMETERS" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="PART_COPY_TESTS" %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h4>{% trans "Part Parameter Templates" %}</h4>
|
||||
|
||||
<div id='param-buttons'>
|
||||
@@ -53,7 +63,7 @@
|
||||
var bEdit = "<button title='{% trans "Edit Template" %}' class='template-edit btn btn-default btn-glyph' type='button' pk='" + row.pk + "'><span class='fas fa-edit'></span></button>";
|
||||
var bDel = "<button title='{% trans "Delete Template" %}' class='template-delete btn btn-default btn-glyph' type='button' pk='" + row.pk + "'><span class='fas fa-trash-alt icon-red'></span></button>";
|
||||
|
||||
var html = "<div class='btn-group' role='group'>" + bEdit + bDel + "</div>";
|
||||
var html = "<div class='btn-group float-right' role='group'>" + bEdit + bDel + "</div>";
|
||||
|
||||
return html;
|
||||
}
|
||||
|
@@ -10,4 +10,10 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block settings %}
|
||||
<table class='table table-striped table-condensed'>
|
||||
<thead></thead>
|
||||
<tbody>
|
||||
{% include "InvenTree/settings/setting.html" with key="PURCHASEORDER_REFERENCE_PREFIX" %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
15
InvenTree/templates/InvenTree/settings/setting.html
Normal file
15
InvenTree/templates/InvenTree/settings/setting.html
Normal file
@@ -0,0 +1,15 @@
|
||||
{% load inventree_extras %}
|
||||
{% load i18n %}
|
||||
|
||||
<tr>
|
||||
<td><b>{% settings_name key %}</b></td>
|
||||
<td><b>{% settings_value key %}</b>{% settings_units key %}</td>
|
||||
<td>{% settings_description key %}</td>
|
||||
<td>
|
||||
<div class='btn-group float-right'>
|
||||
<button class='btn btn-default btn-glyph btn-edit-setting' setting='{{ key }}' title='{% trans "Edit setting" %}'>
|
||||
<span class='fas fa-edit icon-green'></span>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
@@ -10,4 +10,12 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block settings %}
|
||||
|
||||
<table class='table table-striped table-condensed'>
|
||||
<thead></thead>
|
||||
<tbody>
|
||||
{% include "InvenTree/settings/setting.html" with key="SALESORDER_REFERENCE_PREFIX" %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
@@ -42,7 +42,7 @@ function loadBuildTable(table, options) {
|
||||
switchable: false,
|
||||
formatter: function(value, row, index, field) {
|
||||
|
||||
var prefix = "{% inventree_setting 'BUILDORDER_REFERENCE_PREFIX' %}";
|
||||
var prefix = "{% settings_value 'BUILDORDER_REFERENCE_PREFIX' %}";
|
||||
|
||||
if (prefix) {
|
||||
value = `${prefix}${value}`;
|
||||
|
@@ -139,7 +139,7 @@ function loadPurchaseOrderTable(table, options) {
|
||||
title: '{% trans "Purchase Order" %}',
|
||||
formatter: function(value, row, index, field) {
|
||||
|
||||
var prefix = "{% inventree_setting 'PURCHASEORDER_REFERENCE_PREFIX' %}";
|
||||
var prefix = "{% settings_value 'PURCHASEORDER_REFERENCE_PREFIX' %}";
|
||||
|
||||
if (prefix) {
|
||||
value = `${prefix}${value}`;
|
||||
@@ -221,7 +221,7 @@ function loadSalesOrderTable(table, options) {
|
||||
title: '{% trans "Sales Order" %}',
|
||||
formatter: function(value, row, index, field) {
|
||||
|
||||
var prefix = "{% inventree_setting 'SALESORDER_REFERENCE_PREFIX' %}";
|
||||
var prefix = "{% settings_value 'SALESORDER_REFERENCE_PREFIX' %}";
|
||||
|
||||
if (prefix) {
|
||||
value = `${prefix}${value}`;
|
||||
|
Reference in New Issue
Block a user