From 7e8def15ede1c9af2af91bf51442163e84ccabcd Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 28 Jan 2021 20:45:42 +1100 Subject: [PATCH] Hide barcode actions if barcode support is disabled --- InvenTree/part/templates/part/part_base.html | 3 ++ .../stock/templates/stock/item_base.html | 48 +++++++++++-------- InvenTree/stock/templates/stock/location.html | 47 +++++++++--------- 3 files changed, 56 insertions(+), 42 deletions(-) diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html index d7604deae4..84eac7e7f4 100644 --- a/InvenTree/part/templates/part/part_base.html +++ b/InvenTree/part/templates/part/part_base.html @@ -44,6 +44,8 @@ + {% settings_value 'BARCODE_ENABLE' as barcodes %} + {% if barcodes %}
@@ -52,6 +54,7 @@
  • {% trans "Print Label" %}
  • + {% endif %} {% if part.active %} @@ -127,24 +129,26 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
  • {% trans "Show QR Code" %}
  • {% if roles.stock.change %} {% if item.uid %} -
  • {% trans "Unlink Barcode" %}
  • - {% else %} -
  • {% trans "Link Barcode" %}
  • - {% endif %} - {% endif %} - - - - {% if item.has_labels or item.has_test_reports %} -
    - - +
    + {% endif %} + + {% if item.has_labels or item.has_test_reports %} +
    + +
    {% endif %} @@ -447,14 +451,18 @@ $("#show-qr-code").click(function() { }); }); -$("#link-barcode").click(function() { +$("#barcode-link").click(function() { linkBarcodeDialog({{ item.id }}); }); -$("#unlink-barcode").click(function() { +$("#barcode-unlink").click(function() { unlinkBarcode({{ item.id }}); }); +$("#barcode-scan-into-location").click(function() { + scanItemIntoLocation({{ item.id }}); +}); + {% if item.in_stock %} $("#stock-assign-to-customer").click(function() { diff --git a/InvenTree/stock/templates/stock/location.html b/InvenTree/stock/templates/stock/location.html index f3501a50cf..4f8268b037 100644 --- a/InvenTree/stock/templates/stock/location.html +++ b/InvenTree/stock/templates/stock/location.html @@ -37,6 +37,8 @@ {% endif %} {% endif %} + {% settings_value 'BARCODE_ENABLE' as barcodes %} + {% if barcodes %} {% if location %}
    @@ -47,29 +49,30 @@
  • {% trans "Check-in Items" %}
  • - - {% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser %} - {% if roles.stock.change %} - - {% endif %} - {% if roles.stock_location.change %} -
    - - -
    - {% endif %} + {% endif %} + + {% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser %} + {% if roles.stock.change %} + {% endif %} + {% if roles.stock_location.change %} +
    + + +
    + {% endif %} + {% endif %} {% endif %}