Merge branch 'master' of github.com:eeintech/InvenTree into bom_dev

This commit is contained in:
eeintech 2020-07-19 15:05:07 -05:00
commit 51c194fb8f
3 changed files with 34 additions and 4 deletions

View File

@ -9,6 +9,12 @@
<h4>{% trans "Assigned Stock" %}</h4>
<hr>
<div id='button-toolbar'>
<div class='filter-list' id='filter-list-stock'>
<!-- An empty div in which the filter list will be constructed -->
</div>
</div>
<table class='table table-striped table-condensed' id='stock-table'></table>
{% endblock %}
@ -18,12 +24,12 @@
loadStockTable($("#stock-table"), {
params: {
test: 7,
customer: {{ company.id }},
part_detail: true,
location_detail: true,
},
url: "{% url 'api-stock-list' %}",
filterKey: "customerstock",
});
{% endblock %}

View File

@ -234,9 +234,11 @@ function loadStockTable(table, options) {
var filterListElement = options.filterList || "#filter-list-stock";
var filters = {};
var filterKey = options.filterKey || "stock";
if (!options.disableFilters) {
filters = loadTableFilters("stock");
filters = loadTableFilters(filterKey);
}
var original = {};
@ -245,7 +247,7 @@ function loadStockTable(table, options) {
original[key] = params[key];
}
setupFilterList("stock", table, filterListElement);
setupFilterList(filterKey, table, filterListElement);
// Override the default values, or add new ones
for (var key in params) {

View File

@ -11,6 +11,24 @@ function getAvailableTableFilters(tableKey) {
tableKey = tableKey.toLowerCase();
// Filters for the "customer stock" table (really a subset of "stock")
if (tableKey == "customerstock") {
return {
serialized: {
type: 'bool',
title: '{% trans "Is Serialized" %}',
},
serial_gte: {
title: "{% trans "Serial number GTE" %}",
description: "{% trans "Serial number greater than or equal to" %}"
},
serial_lte: {
title: "{% trans "Serial number LTE" %}",
description: "{% trans "Serial number less than or equal to" %}",
},
};
}
// Filters for the "Stock" table
if (tableKey == 'stock') {
return {
@ -39,6 +57,10 @@ function getAvailableTableFilters(tableKey) {
title: '{% trans "Is allocated" %}',
description: '{% trans "Item has been alloacted" %}',
},
serialized: {
type: 'bool',
title: '{% trans "Is Serialized" %}',
},
serial_gte: {
title: "{% trans "Serial number GTE" %}",
description: "{% trans "Serial number greater than or equal to" %}"