{% extends "stock/item_base.html" %} {% load static %} {% load inventree_extras %} {% load i18n %} {% load l10n %} {% block sidebar %} {% include "stock/stock_sidebar.html" %} {% endblock %} {% block page_content %}

{% trans "Stock Tracking Information" %}

{% include "spacer.html" %}
{% if user_owns_item and roles.stock.change and not item.is_building %} {% endif %}
{% include "filter_list.html" with id="stocktracking" %}
{% if item.part.component %}

{% trans "Build Order Allocations" %}

{% include "spacer.html" %}
{% include "filter_list.html" with id="buildorderallocation" %}
{% endif %} {% if item.part.salable %}

{% trans "Sales Order Allocations" %}

{% include "spacer.html" %}
{% include "filter_list.html" with id="salesorderallocation" %}
{% endif %}

{% trans "Child Stock Items" %}

{% include "spacer.html" %}
{% if item.child_count > 0 %} {% include "stock_table.html" with prefix="childs-" %} {% else %}
{% trans "This stock item does not have any child items" %}
{% endif %}

{% trans "Test Data" %}

{% include "spacer.html" %}
{% if user.is_staff %} {% endif %}
{% include "filter_list.html" with id="stocktests" %}

{% trans "Attachments" %}

{% include "spacer.html" %}
{% include "attachment_button.html" %}
{% include "attachment_table.html" %}

{% trans "Stock Item Notes" %}

{% include "spacer.html" %}
{% include "notes_buttons.html" %}

{% trans "Installed Stock Items" %}

{% include "spacer.html" %}
{% include "filter_list.html" with id='installed-items' %}
{% endblock %} {% block js_ready %} {{ block.super }} // Load the "allocations" tab onPanelLoad('allocations', function() { {% if item.part.component %} loadBuildOrderAllocationTable('#build-order-allocation-table', { params: { stock_item: {{ item.pk }}, } }); {% endif %} {% if item.part.salable %} loadSalesOrderAllocationTable('#sales-order-allocation-table', { params: { stock_item: {{ item.pk }}, } }); {% endif %} }); $('#stock-item-install').click(function() { installStockItem({{ item.pk }}, {{ item.part.pk }}, { onSuccess: function(response) { $("#installed-table").bootstrapTable('refresh'); } }); }); loadInstalledInTable( $('#installed-table'), { stock_item: {{ item.pk }}, part: {{ item.part.pk }}, quantity: {{ item.quantity|unlocalize }}, } ); onPanelLoad('notes', function() { setupNotesField( 'stock-notes', '{% url "api-stock-detail" item.pk %}', { {% if roles.stock.change and user_owns_item %} editable: true, {% else %} editable: false, {% endif %} } ); }); enableDragAndDrop( '#attachment-dropzone', "{% url 'api-stock-attachment-list' %}", { data: { stock_item: {{ item.id }}, }, label: 'attachment', success: function(data, status, xhr) { reloadAttachmentTable(); } } ); loadAttachmentTable('{% url "api-stock-attachment-list" %}', { filters: { stock_item: {{ item.pk }}, }, fields: { stock_item: { value: {{ item.pk }}, hidden: true, } } }); loadStockTestResultsTable( $("#test-result-table"), { part: {{ item.part.id }}, stock_item: {{ item.id }}, } ); function reloadTable() { $("#test-result-table").bootstrapTable("refresh"); } {% if item.has_test_reports %} $("#test-report").click(function() { printTestReports([{{ item.pk }}]); }); {% endif %} {% if user.is_staff %} $("#delete-test-results").click(function() { launchModalForm( "{% url 'stock-item-delete-test-data' item.id %}", { success: reloadTable, } ); }); {% endif %} $("#add-test-result").click(function() { constructForm('{% url "api-stock-test-result-list" %}', { method: 'POST', fields: { test: {}, result: {}, value: {}, attachment: {}, notes: {}, stock_item: { value: {{ item.pk }}, hidden: true, } }, title: '{% trans "Add Test Result" %}', onSuccess: reloadTable, }); }); {% if item.child_count > 0 %} loadStockTable($("#childs-stock-table"), { params: { location_detail: true, part_detail: false, ancestor: {{ item.id }}, }, name: 'item-childs', groupByField: 'location', buttons: [ '#stock-options', ], url: "{% url 'api-stock-list' %}", }); {% endif %} $("#new-entry").click(function() { launchModalForm( "{% url 'stock-tracking-create' item.id %}", { reload: true, } ); }); loadStockTrackingTable($("#track-table"), { params: { ordering: '-date', item: {{ item.pk }}, user_detail: true, }, url: "{% url 'api-stock-tracking-list' %}", }); enableSidebar('stockitem'); {% endblock %}