mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Display allocations for individual stock items
This commit is contained in:
parent
60cde7fe13
commit
5ec1d5aab8
@ -846,6 +846,12 @@ class SOAllocationList(generics.ListAPIView):
|
||||
if order is not None:
|
||||
queryset = queryset.filter(line__order=order)
|
||||
|
||||
# Filter by "stock item"
|
||||
item = params.get('item', params.get('stock_item', None))
|
||||
|
||||
if item is not None:
|
||||
queryset = queryset.filter(item=item)
|
||||
|
||||
# Filter by "outstanding" order status
|
||||
outstanding = params.get('outstanding', None)
|
||||
|
||||
@ -865,7 +871,6 @@ class SOAllocationList(generics.ListAPIView):
|
||||
|
||||
# Default filterable fields
|
||||
filter_fields = [
|
||||
'item',
|
||||
]
|
||||
|
||||
|
||||
|
@ -43,9 +43,26 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='panel panel-hidden' id='panel-allocations'>
|
||||
<div class='panel-heading'>
|
||||
<h4>{% trans "Stock Item Allocations" %}</h4>
|
||||
{% include "spacer.html" %}
|
||||
</div>
|
||||
<div class='panel-content'>
|
||||
<div id='allocations-button-toolbar'>
|
||||
<div class='btn-group' role='group'>
|
||||
{% include "filter_list.html" with id="allocations" %}
|
||||
</div>
|
||||
</div>
|
||||
<table class='table table-striped table-condensed' data-toolbar='#allocatoins-button-toolbar' id='stock-allocation-table'></table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class='panel panel-hidden' id='panel-children'>
|
||||
<div class='panel-heading'>
|
||||
<h4>{% trans "Child Stock Items" %}</h4>
|
||||
{% include "spacer.html" %}
|
||||
</div>
|
||||
<div class='panel-content'>
|
||||
{% if item.child_count > 0 %}
|
||||
@ -151,6 +168,19 @@
|
||||
{% block js_ready %}
|
||||
{{ block.super }}
|
||||
|
||||
// Load the "allocations" tab
|
||||
onPanelLoad('allocations', function() {
|
||||
|
||||
loadStockAllocationTable(
|
||||
$("#stock-allocation-table"),
|
||||
{
|
||||
params: {
|
||||
stock_item: {{ item.pk }},
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$('#stock-item-install').click(function() {
|
||||
|
||||
launchModalForm(
|
||||
|
@ -4,6 +4,10 @@
|
||||
|
||||
{% trans "Stock Tracking" as text %}
|
||||
{% include "sidebar_item.html" with label='history' text=text icon="fa-history" %}
|
||||
{% if item.part.salable or item.part.component %}
|
||||
{% trans "Allocations" as text %}
|
||||
{% include "sidebar_item.html" with label="allocations" text=text icon="fa-bookmark" %}
|
||||
{% endif %}
|
||||
{% if item.part.trackable %}
|
||||
{% trans "Test Data" as text %}
|
||||
{% include "sidebar_item.html" with label='test-data' text=text icon="fa-vial" %}
|
||||
|
@ -2308,9 +2308,14 @@ function loadStockAllocationTable(table, options={}) {
|
||||
title: '{% trans "Allocated Quantity" %}',
|
||||
formatter: function(value, row) {
|
||||
var text = value;
|
||||
var url = `/stock/item/${row.stock_item}/`;
|
||||
var pk = row.stock_item || row.item;
|
||||
|
||||
return renderLink(text, url);
|
||||
if (pk) {
|
||||
var url = `/stock/item/${pk}/`;
|
||||
return renderLink(text, url);
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user