diff --git a/InvenTree/label/apps.py b/InvenTree/label/apps.py index 8ec2be24f4..9f2d3ea9c4 100644 --- a/InvenTree/label/apps.py +++ b/InvenTree/label/apps.py @@ -70,6 +70,8 @@ class LabelConfig(AppConfig): 'file': 'qr.html', 'name': 'QR Code', 'description': 'Simple QR code label', + 'width': 24, + 'height': 24, }, ] @@ -116,7 +118,9 @@ class LabelConfig(AppConfig): description=label['description'], label=filename, filters='', - enabled=True + enabled=True, + width=label['width'], + height=label['height'], ) except: pass @@ -156,11 +160,15 @@ class LabelConfig(AppConfig): 'file': 'qr.html', 'name': 'QR Code', 'description': 'Simple QR code label', + 'width': 24, + 'height': 24, }, { 'file': 'qr_and_text.html', 'name': 'QR and text', 'description': 'Label with QR code and name of location', + 'width': 50, + 'height': 24, } ] @@ -207,7 +215,9 @@ class LabelConfig(AppConfig): description=label['description'], label=filename, filters='', - enabled=True + enabled=True, + width=label['width'], + height=label['height'], ) except: pass diff --git a/InvenTree/label/templates/label/stocklocation/qr_and_text.html b/InvenTree/label/templates/label/stocklocation/qr_and_text.html index c5756b96f2..2ff54dc817 100644 --- a/InvenTree/label/templates/label/stocklocation/qr_and_text.html +++ b/InvenTree/label/templates/label/stocklocation/qr_and_text.html @@ -16,7 +16,7 @@ font-family: Arial, Helvetica, sans-serif; display: inline; position: absolute; - left: {{ width }}, + left: {{ height }}mm; top: 2mm; } diff --git a/InvenTree/templates/js/label.js b/InvenTree/templates/js/label.js index 63f028fa1d..cbb71c7b08 100644 --- a/InvenTree/templates/js/label.js +++ b/InvenTree/templates/js/label.js @@ -114,6 +114,18 @@ function selectLabel(labels, items, options={}) { * (via AJAX) from the server. */ + // If only a single label template is provided, + // just run with that! + + if (labels.length == 1) { + if (options.success) { + options.success(labels[0].pk); + } + + return; + } + + var modal = options.modal || '#modal-form'; var label_list = makeOptionsList(