2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 11:10:54 +00:00

Fixes for display of allocation tables (build order and / or sales order)

- Hide these tables where they do not make sense for a given Part or StockItem
- Remove redundant "loadStockAllocationTable" function
This commit is contained in:
Oliver
2022-03-16 23:25:51 +11:00
parent e691536a84
commit e2179fb4d1
3 changed files with 43 additions and 167 deletions

View File

@ -37,19 +37,36 @@
</div>
<div class='panel panel-hidden' id='panel-allocations'>
{% if item.part.component %}
<div class='panel-heading'>
<h4>{% trans "Stock Item Allocations" %}</h4>
<h4>{% trans "Build Order Allocations" %}</h4>
{% include "spacer.html" %}
</div>
<div class='panel-content'>
<div id='allocations-button-toolbar'>
<div id='build-order-allocations-toolbar'>
<div class='btn-group' role='group'>
{% include "filter_list.html" with id="allocations" %}
{% include "filter_list.html" with id="buildorderallocation" %}
</div>
</div>
<table class='table table-striped table-condensed' data-toolbar='#allocatoins-button-toolbar' id='stock-allocation-table'></table>
<table class='table table-striped table-condensed' data-toolbar='#build-order-allocation-toolbar' id='build-order-allocation-table'></table>
</div>
{% endif %}
{% if item.part.salable %}
<div class='panel-heading'>
<h4>{% trans "Sales Order Allocations" %}</h4>
{% include "spacer.html" %}
</div>
<div class='panel-content'>
<div id='sales-order-allocations-toolbar'>
<div class='btn-group' role='group'>
{% include "filter_list.html" with id="salesorderallocation" %}
</div>
</div>
<table class='table table-striped table-condensed' data-toolbar='#sales-order-allocation-toolbar' id='sales-order-allocation-table'></table>
</div>
{% endif %}
</div>
<div class='panel panel-hidden' id='panel-children'>
@ -164,14 +181,21 @@
// Load the "allocations" tab
onPanelLoad('allocations', function() {
loadStockAllocationTable(
$("#stock-allocation-table"),
{
params: {
stock_item: {{ item.pk }},
},
{% 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() {