{% extends "stock/stock_app_base.html" %} {% load static %} {% load barcode %} {% load inventree_extras %} {% load plugin_extras %} {% load i18n %} {% block sidebar %} {% include "stock/location_sidebar.html" %} {% endblock sidebar %} {% block breadcrumb_tree %} {% endblock breadcrumb_tree %} {% block heading %} {% if location %} {% trans "Stock Location" %}: {{ location.name }} {% else %} {% trans "Stock" %} {% endif %} {% endblock heading %} {% block actions %} {% if location %} {% admin_url user "stock.stocklocation" location.pk as url %} {% include "admin_button.html" with url=url %} {% endif %} {% settings_value "STOCKTAKE_ENABLE" as stocktake_enable %} {% if stocktake_enable and roles.stocktake.add %} {% endif %} {% mixin_available "locate" as locate_available %} {% if location and plugins_enabled and locate_available %} {% endif %} {% if barcodes %} {% if location %}
{% if labels_enabled %}
{% endif %} {% if user_owns_location %} {% if roles.stock.change %}
{% endif %} {% if roles.stock_location.change %}
{% endif %} {% endif %} {% endif %} {% endif %} {% endblock actions %} {% block details_left %} {% if location %} {% if location.description %} {% endif %} {% else %} {% endif %} {% if ownership_enabled and location_owner %} {% endif %} {% include "barcode_data.html" with instance=location %}
{% trans "Description" %} {{ location.description }}
{% trans "Location Path" %} {{ location.pathstring }}
{% trans "Location Path" %} {% trans "Top level stock location" %}
{% trans "Location Owner" %} {{ location_owner }} {% if not user_owns_location %} {% trans "Read only" %} {% endif %}
{% endblock details_left %} {% block details_right %} {% if location %} {% if location.location_type %} {% endif %}
{% trans "Sublocations" %} {{ location.children.count }}
{% trans "Stock Items" %} {{ location.item_count }}
{% trans "Location Type" %} {{ location.location_type }}
{% else %}
{% trans "Stock Locations" %} {{ loc_count }}
{% trans "Stock Items" %} {{ stock_count }}
{% endif %} {% endblock details_right %} {% block page_content %}

{% trans "Stock Items" %}

{% include "spacer.html" %}
{% if roles.stock.add and not part.virtual %} {% endif %}
{% include "stock_table.html" %}

{% trans "Sublocations" %}

{% include "spacer.html" %}
{% if user_owns_location and roles.stock_location.add %} {% endif %}
{% include "filter_list.html" with id="location" %}
{% endblock page_content %} {% block js_ready %} {{ block.super }} loadApiIconPacks().then(() => { $('#location-icon').addClass(getApiIconClass('{{ location.icon }}')); }); {% settings_value "STOCKTAKE_ENABLE" as stocktake_enable %} {% if stocktake_enable and roles.stocktake.add %} $('#location-stocktake').click(function() { generateStocktakeReport({ category: { tree_picker: { url: '{% url "api-part-category-tree" %}', }, }, location: { {% if location %}value: {{ location.pk }},{% endif %} tree_picker: { url: '{% url "api-location-tree" %}', }, }, generate_report: {}, update_parts: {}, }); }); {% endif %} {% if plugins_enabled and location %} $('#locate-location-button').click(function() { locateItemOrLocation({ location: {{ location.pk }}, }); }); {% endif %} onPanelLoad('sublocations', function() { loadStockLocationTable($('#sublocation-table'), { params: { {% if location %} parent: {{ location.pk }}, {% else %} top_level: true, {% endif %} }, allowTreeView: true, }); }); {% if labels_enabled %} $('#print-label').click(function() { var locs = [{{ location.pk }}]; printLabels({ items: locs, model_type: 'stocklocation', singular_name: '{% trans "stock location" escape %}', }); }); {% endif %} {% if report_enabled %} $('#print-location-report').click(function() { printReports('stocklocation', [{{ location.pk }}]); }); {% endif %} {% if location %} $("#barcode-scan-in-items").click(function() { barcodeCheckInStockItems({{ location.id }}); }); $('#barcode-scan-in-containers').click(function() { barcodeCheckInStockLocations({{ location.id }}, { onSuccess: function() { showMessage( '{% trans "Scanned stock container into this location" escape %}', { style: 'success', } ); $('#sublocation-table').bootstrapTable('refresh'); } } ); }); {% endif %} $('#location-create').click(function () { createStockLocation({ {% if location %} parent: {{ location.pk }}, {% endif %} follow: true, }); }); {% if location %} $('#location-edit').click(function() { editStockLocation({{ location.id }}, { reload: true, }); }); $('#location-delete').click(function() { deleteStockLocation({{ location.pk }}, { {% if location.parent %} redirect: '{% url "stock-location-detail" location.parent.pk %}', {% else %} redirect: '{% url "stock-index" %}', {% endif %} }); }); function adjustLocationStock(action) { inventreeGet( '{% url "api-stock-list" %}', { location: {{ location.id }}, in_stock: true, part_detail: true, location_detail: true, }, { success: function(items) { adjustStock(action, items, { success: function() { location.reload(); } }); } } ); } $("#location-count").click(function() { adjustLocationStock('count'); }); $("#location-move").click(function() { adjustLocationStock('move'); }); {% if barcodes %} $('#show-qr-code').click(function() { showQRDialog( '{% trans "Stock Location QR Code" escape %}', `{% clean_barcode location.barcode %}` ); }); $("#barcode-link").click(function() { linkBarcodeDialog( { stocklocation: {{ location.pk }}, }, { title: '{% trans "Link Barcode to Stock Location" escape %}', } ); }); $("#barcode-unlink").click(function() { unlinkBarcode({ stocklocation: {{ location.pk }}, }); }); {% endif %} {% endif %} $('#item-create').click(function () { createNewStockItem({ data: { {% if location %} location: {{ location.id }} {% endif %} }, }); }); onPanelLoad('stock', function() { loadStockTable($("#stock-table"), { params: { {% if location %} location: {{ location.pk }}, {% endif %} part_detail: true, location_detail: true, supplier_part_detail: true, }, }); }); enableSidebar('stocklocation'); // Enable breadcrumb tree view enableBreadcrumbTree({ label: 'location', url: '{% url "api-location-tree" %}', {% if location %} selected: {{ location.pk }}, {% endif %} processNode: function(node) { node.text = node.name; node.href = `/stock/location/${node.pk}/`; return node; }, }); {% endblock js_ready %}