mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Further cleanup
This commit is contained in:
parent
1b6843e72d
commit
597ab37ba6
@ -408,6 +408,10 @@ class PartList(generics.ListCreateAPIView):
|
|||||||
# Filter by whether the BOM has been validated (or not)
|
# Filter by whether the BOM has been validated (or not)
|
||||||
bom_valid = params.get('bom_valid', None)
|
bom_valid = params.get('bom_valid', None)
|
||||||
|
|
||||||
|
# TODO: Querying bom_valid status may be quite expensive
|
||||||
|
# TODO: (It needs to be profiled!)
|
||||||
|
# TODO: It might be worth caching the bom_valid status to a database column
|
||||||
|
|
||||||
if bom_valid is not None:
|
if bom_valid is not None:
|
||||||
|
|
||||||
bom_valid = str2bool(bom_valid)
|
bom_valid = str2bool(bom_valid)
|
||||||
@ -499,6 +503,9 @@ class PartList(generics.ListCreateAPIView):
|
|||||||
# Filter by "parts which need stock to complete build"
|
# Filter by "parts which need stock to complete build"
|
||||||
stock_to_build = params.get('stock_to_build', None)
|
stock_to_build = params.get('stock_to_build', None)
|
||||||
|
|
||||||
|
# TODO: This is super expensive, database query wise...
|
||||||
|
# TODO: Need to figure out a cheaper way of making this filter query
|
||||||
|
|
||||||
if stock_to_build is not None:
|
if stock_to_build is not None:
|
||||||
# Filter only active parts
|
# Filter only active parts
|
||||||
queryset = queryset.filter(active=True)
|
queryset = queryset.filter(active=True)
|
||||||
|
@ -82,19 +82,20 @@ loadBuildTable("#build-pending-table", {
|
|||||||
params: {
|
params: {
|
||||||
part_detail: true,
|
part_detail: true,
|
||||||
active: true,
|
active: true,
|
||||||
}
|
},
|
||||||
|
disableFilters: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
loadSimplePartTable("#low-stock-table", "{% url 'api-part-list' %}", {
|
loadSimplePartTable("#low-stock-table", "{% url 'api-part-list' %}", {
|
||||||
params: {
|
params: {
|
||||||
"low_stock": true,
|
low_stock: true,
|
||||||
},
|
},
|
||||||
name: "low_stock_parts",
|
name: "low_stock_parts",
|
||||||
});
|
});
|
||||||
|
|
||||||
loadSimplePartTable("#stock-to-build-table", "{% url 'api-part-list' %}", {
|
loadSimplePartTable("#stock-to-build-table", "{% url 'api-part-list' %}", {
|
||||||
params: {
|
params: {
|
||||||
"stock_to_build": true,
|
stock_to_build: true,
|
||||||
},
|
},
|
||||||
name: "to_build_parts",
|
name: "to_build_parts",
|
||||||
});
|
});
|
||||||
@ -102,17 +103,17 @@ loadSimplePartTable("#stock-to-build-table", "{% url 'api-part-list' %}", {
|
|||||||
loadPurchaseOrderTable("#po-outstanding-table", {
|
loadPurchaseOrderTable("#po-outstanding-table", {
|
||||||
url: "{% url 'api-po-list' %}",
|
url: "{% url 'api-po-list' %}",
|
||||||
params: {
|
params: {
|
||||||
"supplier_detail": true,
|
supplier_detail: true,
|
||||||
"outstanding": true,
|
outstanding: true,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
loadSalesOrderTable("#so-outstanding-table", {
|
loadSalesOrderTable("#so-outstanding-table", {
|
||||||
url: "{% url 'api-so-list' %}",
|
url: "{% url 'api-so-list' %}",
|
||||||
params: {
|
params: {
|
||||||
"customer_detail": true,
|
customer_detail: true,
|
||||||
"outstanding": true,
|
outstanding: true,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#latest-parts-table").on('load-success.bs.table', function() {
|
$("#latest-parts-table").on('load-success.bs.table', function() {
|
||||||
|
@ -5,7 +5,11 @@ function loadBuildTable(table, options) {
|
|||||||
|
|
||||||
var params = options.params || {};
|
var params = options.params || {};
|
||||||
|
|
||||||
var filters = loadTableFilters("build");
|
var filters = {};
|
||||||
|
|
||||||
|
if (!options.disableFilters) {
|
||||||
|
loadTableFilters("build");
|
||||||
|
}
|
||||||
|
|
||||||
for (var key in params) {
|
for (var key in params) {
|
||||||
filters[key] = params[key];
|
filters[key] = params[key];
|
||||||
|
Loading…
Reference in New Issue
Block a user