{% 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 %}
|
{% trans "Base Part" %} |
{% if roles.part.view %}
{% endif %}
{{ item.part.full_name }}
{% if roles.part.view %}
{% endif %}
{% if item.part.description %}
{% endif %}
|
{% include "barcode_data.html" with instance=item %}
{% if item.batch %}
|
{% trans "Batch" %} |
{{ item.batch }} |
{% endif %}
{% if item.build %}
|
{% trans "Build" %} |
{{ item.build }} |
{% endif %}
{% if item.purchase_order %}
|
{% trans "Purchase Order" %} |
{{ item.purchase_order }} |
{% endif %}
{% if item.purchase_price != None %}
|
{% trans "Purchase Price" %} |
{% render_currency item.purchase_price %}
{% if item.part.units %} / {{ item.part.units }}{% endif %}
|
{% endif %}
{% if item.parent %}
|
{% trans "Parent Item" %} |
{% trans "Stock Item" %} #{{ item.parent.id }} |
{% endif %}
{% if item.link %}
| {% trans "External Link" %} |
{% include 'clip_link.html' with link=item.link new_window=True %} |
{% endif %}
{% if item.supplier_part.manufacturer_part %}
|
{% trans "Manufacturer" %} |
{% if item.supplier_part.manufacturer_part.manufacturer %}
{{ item.supplier_part.manufacturer_part.manufacturer.name }} |
{% else %}
{% trans "No manufacturer set" %} |
{% endif %}
|
{% trans "Manufacturer Part" %} |
{{ item.supplier_part.manufacturer_part.MPN }} |
{% endif %}
{% if item.supplier_part %}
|
{% trans "Supplier" %} |
{% if item.supplier_part.supplier %}
{{ item.supplier_part.supplier.name }}
{% endif %}
|
|
{% trans "Supplier Part" %} |
{{ item.supplier_part.SKU }} |
{% endif %}
{% if item.packaging %}
|
{% trans "Packaging" %} |
{{ item.packaging }} |
{% endif %}
{% if ownership_enabled and item_owner %}
|
{% trans "Owner" %} |
{{ item_owner }}
{% if not user_owns_item %}
{% trans "Read only" %}
{% endif %}
|
{% 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 %}
|
{% trans "Serial Number" %}
|
|
{% else %}
|
{% 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 %}
|
{% endif %}
{% if item.belongs_to %}
|
{% trans "Installed In" %}
|
{{ item.belongs_to }}
|
{% elif item.consumed_by %}
|
{% trans "Consumed By" %} |
{{ item.consumed_by }} |
{% elif item.sales_order %}
|
{% trans "Sales Order" %} |
{{ item.sales_order.reference }}
{% if item.sales_order.customer %}
- {{ item.sales_order.customer.name }}
{% endif %}
|
{% else %}
{% if allocated_to_sales_orders %}
|
{% trans "Allocated to Sales Orders" %} |
{% decimal allocated_to_sales_orders %} |
{% endif %}
{% if allocated_to_build_orders %}
|
{% trans "Allocated to Build Orders" %} |
{% decimal allocated_to_build_orders %} |
{% endif %}
|
{% trans "Location" %} |
{% if item.location %}
{{ item.location.name }} |
{% elif not item.customer %}
{% trans "No location set" %} |
{% endif %}
{% endif %}
{% if item.customer %}
|
{% trans "Customer" %} |
{{ item.customer.name }} |
{% endif %}
{% if item.hasRequiredTests %}
|
{% trans "Tests" %} |
{{ item.requiredTestStatus.passed }} / {{ item.requiredTestStatus.total }}
{% if item.passedAllRequiredTests %}
{% else %}
{% endif %}
|
{% endif %}
|
{% trans "Status" %} |
{% display_status_label 'stock' item.status_custom_key item.status %} |
{% if item.expiry_date %}
|
{% trans "Expiry Date" %} |
{% render_date item.expiry_date %}
{% if item.is_expired %}
{% trans "Expired" %}
{% elif item.is_stale %}
{% trans "Stale" %}
{% endif %}
|
{% endif %}
|
{% trans "Last Updated" %} |
{{ item.updated }} |
|
{% trans "Last Stocktake" %} |
{% if item.stocktake_date %}
{% render_date item.stocktake_date %} {{ item.stocktake_user }} |
{% else %}
{% trans "No stocktake performed" %} |
{% 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() {
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 = `