{% extends "page_base.html" %} {% load static %} {% load inventree_extras %} {% load status_codes %} {% load i18n %} {% load l10n %} {% block page_title %} {% inventree_title %} | {% trans "Stock Item" %} - {{ item }} {% endblock %} {% block breadcrumbs %} {% include 'stock/loc_link.html' with location=item.location %} {% endblock %} {% block breadcrumb_tree %} {% endblock breadcrumb_tree %} {% block heading %} {% trans "Stock Item" %}: {{ item.part.full_name}} {% endblock heading %} {% block actions %} {% if user.is_staff and roles.stock.change %} {% url 'admin:stock_stockitem_change' item.pk as url %} {% include "admin_button.html" with url=url %} {% 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 %} {% endblock thumbnail %} {% block details %} {% if item.serialized %} {% else %} {% endif %} {% if item.expiry_date %} {% endif %} {% if item.stocktake_date %} {% else %} {% endif %}
{% trans "Base Part" %} {% if roles.part.view %} {% endif %} {{ item.part.full_name }} {% if roles.part.view %} {% endif %}
{% trans "Serial Number" %} {{ item.serial }}
{% if previous %} {{ previous.serial }} {% endif %} {% if next %} {{ next.serial }} {% endif %}
{% trans "Quantity" %} {% decimal item.quantity %} {% if item.part.units %}{{ item.part.units }}{% endif %}
{% trans "Status" %} {% stock_status_label 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" %}
{% 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 %} {% if item.hasRequiredTests and not item.passedAllRequiredTests %}
{% trans "This stock item has not passed all required tests" %}
{% endif %} {% for allocation in item.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 %} {% if item.serialized %}
{% trans "This stock item is serialized - it has a unique serial number and the quantity cannot be adjusted." %}
{% endif %}
{% endblock details %} {% block details_right %} {% if item.customer %} {% endif %} {% if item.belongs_to %} {% elif item.sales_order %} {% else %} {% if item.location %} {% else %} {% endif %} {% endif %} {% if item.uid %} {% endif %} {% if item.batch %} {% endif %} {% if item.packaging %} {% 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.hasRequiredTests %} {% endif %} {% if ownership_enabled and item_owner %} {% endif %}
{% trans "Customer" %} {{ item.customer.name }}
{% trans "Installed In" %} {{ item.belongs_to }}
{% trans "Sales Order" %} {{ item.sales_order.reference }} - {{ item.sales_order.customer.name }}
{% trans "Location" %}{{ item.location.name }}{% trans "No location set" %}
{% trans "Barcode Identifier" %} {{ item.uid }}
{% trans "Batch" %} {{ item.batch }}
{% trans "Packaging" %} {{ item.packaging }}
{% trans "Build" %} {{ item.build }}
{% trans "Purchase Order" %} {{ item.purchase_order }}
{% trans "Purchase Price" %} {{ item.purchase_price }}
{% trans "Parent Item" %} {% trans "Stock Item" %} #{{ item.parent.id }}
{% trans "External Link" %} {{ item.link }}
{% trans "Manufacturer" %}{{ item.supplier_part.manufacturer_part.manufacturer.name }}{% trans "No manufacturer set" %}
{% trans "Manufacturer Part" %} {{ item.supplier_part.manufacturer_part.MPN }}
{% trans "Supplier" %} {{ item.supplier_part.supplier.name }}
{% trans "Supplier Part" %} {{ item.supplier_part.SKU }}
{% trans "Tests" %} {{ item.requiredTestStatus.passed }} / {{ item.requiredTestStatus.total }} {% if item.passedAllRequiredTests %} {% else %} {% endif %}
{% trans "Owner" %} {{ item_owner }} {% if not user_owns_item %} {% trans "Read only" %} {% endif %}
{% 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() { launchModalForm( "{% url 'stock-item-uninstall' %}", { data: { 'items[]': [{{ item.pk }}], }, reload: true, } ); }); $("#stock-test-report").click(function() { printTestReports([{{ item.pk }}]); }); $("#print-label").click(function() { printStockItemLabels([{{ item.pk }}]); }); {% 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" %}', }); }); {% endif %} $("#show-qr-code").click(function() { launchModalForm("{% url 'stock-item-qr' item.id %}", { no_post: true, }); }); $("#barcode-link").click(function() { linkBarcodeDialog({{ item.id }}); }); $("#barcode-unlink").click(function() { unlinkBarcode({{ item.id }}); }); $("#barcode-scan-into-location").click(function() { scanItemsIntoLocation([{{ item.id }}]); }); 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 () { launchModalForm( "{% url 'stock-item-delete' item.id %}", { redirect: "{% url 'part-detail' item.part.id %}" } ); }); {% if item.part.can_convert %} $("#stock-convert").click(function() { launchModalForm("{% url 'stock-item-convert' item.id %}", { reload: true, } ); }); {% endif %} {% if item.in_stock %} $("#stock-assign-to-customer").click(function() { inventreeGet('{% url "api-stock-detail" item.pk %}', {}, { success: function(response) { assignStockToCustomer( [response], { success: function() { location.reload(); }, } ); } }); }); $("#stock-move").click(function() { itemAdjust("move"); }); $("#stock-count").click(function() { itemAdjust('count'); }); $('#stock-remove').click(function() { itemAdjust('take'); }); {% else %} $("#stock-return-from-customer").click(function() { launchModalForm("{% url 'stock-item-return' item.id %}", { reload: true, } ); }); {% 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 %}