diff --git a/InvenTree/InvenTree/version.py b/InvenTree/InvenTree/version.py
index f97f134e4a..8d9b0e8da1 100644
--- a/InvenTree/InvenTree/version.py
+++ b/InvenTree/InvenTree/version.py
@@ -196,7 +196,7 @@ def isInvenTreeUpToDate():
and stores it to the database as INVENTREE_LATEST_VERSION
"""
- latest = common.models.InvenTreeSetting.get_setting('INVENTREE_LATEST_VERSION', None)
+ latest = common.models.InvenTreeSetting.get_setting('INVENTREE_LATEST_VERSION', backup_value=None, create=False)
# No record for "latest" version - we must assume we are up to date!
if not latest:
diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py
index ad144cd8db..20acd84ce1 100644
--- a/InvenTree/common/models.py
+++ b/InvenTree/common/models.py
@@ -1247,6 +1247,13 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
'validator': bool,
},
+ 'LABEL_ENABLE': {
+ 'name': _('Enable label printing'),
+ 'description': _('Enable label printing from the web interface'),
+ 'default': True,
+ 'validator': bool,
+ },
+
"LABEL_INLINE": {
'name': _('Inline label display'),
'description': _('Display PDF labels in the browser, instead of downloading as a file'),
diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html
index d14cfbdfd5..e560ebe03c 100644
--- a/InvenTree/part/templates/part/part_base.html
+++ b/InvenTree/part/templates/part/part_base.html
@@ -37,13 +37,17 @@
{% endif %}
-{% if barcodes %}
+{% if barcodes or labels_enabled %}
+ {% include "InvenTree/settings/setting.html" with key="LABEL_ENABLE" icon='fa-toggle-on' user_setting=True %}
{% include "InvenTree/settings/setting.html" with key="LABEL_INLINE" icon='fa-tag' user_setting=True %}
diff --git a/InvenTree/templates/base.html b/InvenTree/templates/base.html
index 6f364ce64b..d3c8ed8a59 100644
--- a/InvenTree/templates/base.html
+++ b/InvenTree/templates/base.html
@@ -6,6 +6,7 @@
{% settings_value 'REPORT_ENABLE_TEST_REPORT' as test_report_enabled %}
{% settings_value "REPORT_ENABLE" as report_enabled %}
{% settings_value "SERVER_RESTART_REQUIRED" as server_restart_required %}
+{% settings_value "LABEL_ENABLE" with user=user as labels_enabled %}
{% inventree_demo_mode as demo_mode %}
diff --git a/InvenTree/templates/js/dynamic/settings.js b/InvenTree/templates/js/dynamic/settings.js
index 4e7d36f72b..2832bd3482 100644
--- a/InvenTree/templates/js/dynamic/settings.js
+++ b/InvenTree/templates/js/dynamic/settings.js
@@ -4,6 +4,7 @@
editSetting,
user_settings,
global_settings,
+ plugins_enabled,
*/
{% user_settings request.user as USER_SETTINGS %}
@@ -20,6 +21,13 @@ const global_settings = {
{% endfor %}
};
+{% plugins_enabled as p_en %}
+{% if p_en %}
+const plugins_enabled = true;
+{% else %}
+const plugins_enabled = false;
+{% endif %}
+
/*
* Edit a setting value
*/
diff --git a/InvenTree/templates/js/translated/build.js b/InvenTree/templates/js/translated/build.js
index 46f7f32e42..201d3c5c9f 100644
--- a/InvenTree/templates/js/translated/build.js
+++ b/InvenTree/templates/js/translated/build.js
@@ -1025,9 +1025,10 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
}
// Store the required quantity in the row data
- row.required = quantity;
+ // Prevent weird rounding issues
+ row.required = parseFloat(quantity.toFixed(15));
- return quantity;
+ return row.required;
}
function sumAllocations(row) {
@@ -1043,9 +1044,9 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
quantity += item.quantity;
});
- row.allocated = quantity;
+ row.allocated = parseFloat(quantity.toFixed(15));
- return quantity;
+ return row.allocated;
}
function setupCallbacks() {
@@ -1642,6 +1643,9 @@ function allocateStockToBuild(build_id, part_id, bom_items, options={}) {
remaining = 0;
}
+ // Ensure the quantity sent to the form field is correctly formatted
+ remaining = parseFloat(remaining.toFixed(15));
+
// We only care about entries which are not yet fully allocated
if (remaining > 0) {
table_entries += renderBomItemRow(bom_item, remaining);
diff --git a/InvenTree/templates/js/translated/label.js b/InvenTree/templates/js/translated/label.js
index c0f4c2f735..d19c403861 100644
--- a/InvenTree/templates/js/translated/label.js
+++ b/InvenTree/templates/js/translated/label.js
@@ -10,6 +10,7 @@
modalSetTitle,
modalSubmit,
openModal,
+ plugins_enabled,
showAlertDialog,
*/
@@ -232,26 +233,28 @@ function selectLabel(labels, items, options={}) {
var plugins = [];
// Request a list of available label printing plugins from the server
- inventreeGet(
- `/api/plugin/`,
- {},
- {
- async: false,
- success: function(response) {
- response.forEach(function(plugin) {
- // Look for active plugins which implement the 'labels' mixin class
- if (plugin.active && plugin.mixins && plugin.mixins.labels) {
- // This plugin supports label printing
- plugins.push(plugin);
- }
- });
+ if (plugins_enabled) {
+ inventreeGet(
+ `/api/plugin/`,
+ {},
+ {
+ async: false,
+ success: function(response) {
+ response.forEach(function(plugin) {
+ // Look for active plugins which implement the 'labels' mixin class
+ if (plugin.active && plugin.mixins && plugin.mixins.labels) {
+ // This plugin supports label printing
+ plugins.push(plugin);
+ }
+ });
+ }
}
- }
- );
+ );
+ }
var plugin_selection = '';
- if (plugins.length > 0) {
+ if (plugins_enabled && plugins.length > 0) {
plugin_selection =`