{% extends "page_base.html" %} {% load static %} {% load plugin_extras %} {% load inventree_extras %} {% load generic %} {% load barcode %} {% load i18n %} {% load l10n %} {% block page_title %} {% inventree_title %} | {% trans "Stock Item" %} - {{ item }} {% endblock page_title %} {% block breadcrumbs %} {% include 'stock/loc_link.html' with location=item.location %} {% endblock breadcrumbs %} {% block breadcrumb_tree %} {% endblock breadcrumb_tree %} {% block heading %} {% trans "Stock Item" %}: {{ item.part.full_name }} {% endblock heading %} {% block actions %} {% admin_url user "stock.stockitem" item.pk as url %} {% include "admin_button.html" with url=url %} {% mixin_available "locate" as locate_available %} {% if plugins_enabled and locate_available %} {% endif %} {% if barcodes %}
{% endif %}
{% if user_owns_item %} {% if roles.stock.change and not item.is_building %}
{% endif %} {% if roles.stock.change and not item.is_building %}
{% endif %} {% endif %} {% endblock actions %} {% block thumbnail %} {% trans "Image" %} {% endblock thumbnail %} {% block details %} {% include "barcode_data.html" with instance=item %} {% if item.batch %} {% endif %} {% if item.build %} {% endif %} {% if item.purchase_order %} {% endif %} {% if item.purchase_price != None %} {% endif %} {% if item.parent %} {% endif %} {% if item.link %} {% endif %} {% if item.supplier_part.manufacturer_part %} {% if item.supplier_part.manufacturer_part.manufacturer %} {% else %} {% endif %} {% endif %} {% if item.supplier_part %} {% endif %} {% if item.packaging %} {% endif %} {% if ownership_enabled and item_owner %} {% endif %}
{% trans "Base Part" %} {% if roles.part.view %} {% endif %} {{ item.part.full_name }} {% if roles.part.view %} {% endif %} {% if item.part.description %} {% endif %}
{% trans "Batch" %} {{ item.batch }}
{% trans "Build" %} {{ item.build }}
{% trans "Purchase Order" %} {{ item.purchase_order }}
{% trans "Purchase Price" %} {% render_currency item.purchase_price %} {% if item.part.units %} / {{ item.part.units }}{% endif %}
{% trans "Parent Item" %} {% trans "Stock Item" %} #{{ item.parent.id }}
{% trans "External Link" %} {% include 'clip_link.html' with link=item.link new_window=True %}
{% trans "Manufacturer" %}{{ item.supplier_part.manufacturer_part.manufacturer.name }}{% trans "No manufacturer set" %}
{% trans "Manufacturer Part" %} {{ item.supplier_part.manufacturer_part.MPN }}
{% trans "Supplier" %} {% if item.supplier_part.supplier %} {{ item.supplier_part.supplier.name }} {% endif %}
{% trans "Supplier Part" %} {{ item.supplier_part.SKU }}
{% trans "Packaging" %} {{ item.packaging }}
{% trans "Owner" %} {{ item_owner }} {% if not user_owns_item %} {% trans "Read only" %} {% endif %}
{% if not item.in_stock %}
{% trans "This stock item is unavailable" %}
{% endif %} {% if item.is_building %}
{% trans "This stock item is in production and cannot be edited." %}
{% trans "Edit the stock item from the build view." %}
{% if item.build %} {{ item.build }} {% endif %}
{% endif %} {% for allocation in item.get_sales_order_allocations.all %}
{% object_link 'so-detail' allocation.line.order.id allocation.line.order as link %} {% decimal allocation.quantity as qty %} {% trans "This stock item is allocated to Sales Order" %} {{ link }} {% if qty < item.quantity %}({% trans "Quantity" %}: {{ qty }}){% endif %}
{% endfor %} {% for allocation in item.allocations.all %}
{% object_link 'build-detail' allocation.build.id allocation.build as link %} {% decimal allocation.quantity as qty %} {% trans "This stock item is allocated to Build Order" %} {{ link }} {% if qty < item.quantity %}({% trans "Quantity" %}: {{ qty }}){% endif %}
{% endfor %}
{% endblock details %} {% block details_right %} {% if item.serialized %} {% else %} {% endif %} {% if item.belongs_to %} {% elif item.consumed_by %} {% elif item.sales_order %} {% else %} {% if allocated_to_sales_orders %} {% endif %} {% if allocated_to_build_orders %} {% endif %} {% if item.location %} {% elif not item.customer %} {% endif %} {% endif %} {% if item.customer %} {% endif %} {% if item.hasRequiredTests %} {% endif %} {% if item.expiry_date %} {% endif %} {% if item.stocktake_date %} {% else %} {% endif %}
{% trans "Serial Number" %}
{{ item.serial }}
{% if previous %} {{ previous.serial }} {% endif %} {% if next %} {{ next.serial }} {% endif %}
{% if item.in_stock %}
{% trans "Available Quantity" %}
{% else %}
{% trans "Quantity" %}
{% endif %}
{% if item.quantity != available %}{% decimal available %} / {% endif %}{% decimal item.quantity %} {% include "part/part_units.html" with part=item.part %}
{% trans "Installed In" %} {{ item.belongs_to }}
{% trans "Consumed By" %} {{ item.consumed_by }}
{% trans "Sales Order" %} {{ item.sales_order.reference }} {% if item.sales_order.customer %} - {{ item.sales_order.customer.name }} {% endif %}
{% trans "Allocated to Sales Orders" %} {% decimal allocated_to_sales_orders %}
{% trans "Allocated to Build Orders" %} {% decimal allocated_to_build_orders %}
{% trans "Location" %}{{ item.location.name }}{% trans "No location set" %}
{% trans "Customer" %} {{ item.customer.name }}
{% trans "Tests" %} {{ item.requiredTestStatus.passed }} / {{ item.requiredTestStatus.total }} {% if item.passedAllRequiredTests %} {% else %} {% endif %}
{% trans "Status" %} {% display_status_label 'stock' item.status_custom_key item.status %}
{% trans "Expiry Date" %} {% render_date item.expiry_date %} {% if item.is_expired %} {% trans "Expired" %} {% elif item.is_stale %} {% trans "Stale" %} {% endif %}
{% trans "Last Updated" %} {{ item.updated }}
{% trans "Last Stocktake" %}{% render_date item.stocktake_date %} {{ item.stocktake_user }}{% trans "No stocktake performed" %}
{% endblock details_right %} {% block js_ready %} {{ block.super }} $("#stock-serialize").click(function() { serializeStockItem({{ item.pk }}, { part: {{ item.part.pk }}, reload: true, data: { quantity: {{ item.quantity|unlocalize }}, {% if item.location %} destination: {{ item.location.pk }}, {% elif item.part.default_location %} destination: {{ item.part.default_location.pk }}, {% endif %} } }); }); $('#stock-install-in').click(function() { // TODO - Launch dialog to install this item *into* another stock item }); $('#stock-uninstall').click(function() { uninstallStockItem( {{ item.pk }}, { reload: true, } ); }); $("#stock-test-report").click(function() { printReports('stockitem', [{{ item.pk }}]); }); $("#print-label").click(function() { printLabels({ items: [{{ item.pk }}], model_type: 'stockitem', singular_name: '{% trans "stock item" escape %}', }); }); {% if roles.stock.change %} $("#stock-duplicate").click(function() { // Duplicate a stock item duplicateStockItem({{ item.pk }}, {}); }); $('#stock-edit').click(function() { editStockItem({{ item.pk }}, { reload: true, }); }); $('#stock-edit-status').click(function () { constructForm('{% url "api-stock-detail" item.pk %}', { fields: { status: {}, }, reload: true, title: '{% trans "Edit Stock Status" escape %}', }); }); {% endif %} {% if barcodes %} $("#show-qr-code").click(function() { showQRDialog( '{% trans "Stock Item QR Code" escape %}', `{% clean_barcode item.barcode %}` ); }); $("#barcode-link").click(function() { linkBarcodeDialog( { stockitem: {{ item.pk }}, }, { title: '{% trans "Link Barcode to Stock Item" escape %}', } ); }); $("#barcode-unlink").click(function() { unlinkBarcode({ stockitem: {{ item.pk }}, }); }); $("#barcode-scan-into-location").click(function() { inventreeGet('{% url "api-stock-detail" item.pk %}', {}, { success: function(item) { scanItemsIntoLocation([item]); } }); }); {% endif %} {% if plugins_enabled %} $('#locate-item-button').click(function() { locateItemOrLocation({ item: {{ item.pk }}, }); }); {% endif %} function itemAdjust(action) { inventreeGet( '{% url "api-stock-detail" item.pk %}', { part_detail: true, location_detail: true, }, { success: function(item) { adjustStock(action, [item], { success: function() { location.reload(); } }); } } ); } $('#stock-add').click(function() { itemAdjust('add'); }); $("#stock-delete").click(function () { deleteStockItem({{ item.pk }}, { redirect: '{% url "part-detail" item.part.pk %}', }); }); {% if item.part.can_convert %} $("#stock-convert").click(function() { var html = `
{% trans "Select one of the part variants listed below." %}
{% trans "Warning" %} {% trans "This action cannot be easily undone" %}
`; constructForm( '{% url "api-stock-item-convert" item.pk %}', { method: 'POST', title: '{% trans "Convert Stock Item" escape %}', preFormContent: html, reload: true, fields: { part: { filters: { convert_from: {{ item.part.pk }} } }, } } ); }); {% endif %} {% if item.customer %} $("#stock-return-from-customer").click(function() { constructForm('{% url "api-stock-item-return" item.pk %}', { fields: { location: { {% if item.part.default_location %} value: {{ item.part.default_location.pk }}, {% endif %} tree_picker: { url: '{% url "api-location-tree" %}', }, }, notes: { icon: 'fa-sticky-note', }, }, method: 'POST', title: '{% trans "Return to Stock" escape %}', reload: true, }); }); {% else %} $("#stock-assign-to-customer").click(function() { inventreeGet('{% url "api-stock-detail" item.pk %}', {}, { success: function(response) { assignStockToCustomer( [response], { success: function() { location.reload(); }, } ); } }); }); {% endif %} {% if item.can_adjust_location %} $("#stock-move").click(function() { itemAdjust("move"); }); $("#stock-count").click(function() { itemAdjust('count'); }); $('#stock-remove').click(function() { itemAdjust('take'); }); {% endif %} $('#serial-number-search').click(function() { findStockItemBySerialNumber({{ item.part.pk }}); }); enableBreadcrumbTree({ label: 'stockitem', url: '{% url "api-location-tree" %}', {% if item.location %} selected: {{ item.location.pk }}, {% endif %} processNode: function(node) { node.text = node.name; node.href = `/stock/location/${node.pk}/`; return node; } }); {% endblock js_ready %}