mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add filter for supplier part table:
Filter by "active" status
This commit is contained in:
parent
60a8ef723b
commit
b3ac261746
@ -131,6 +131,13 @@ class SupplierPartList(generics.ListCreateAPIView):
|
|||||||
if part is not None:
|
if part is not None:
|
||||||
queryset = queryset.filter(part=part)
|
queryset = queryset.filter(part=part)
|
||||||
|
|
||||||
|
# Filter by 'active' status of the part?
|
||||||
|
active = params.get('active', None)
|
||||||
|
|
||||||
|
if active is not None:
|
||||||
|
active = str2bool(active)
|
||||||
|
queryset = queryset.filter(part__active=active)
|
||||||
|
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
def get_serializer(self, *args, **kwargs):
|
def get_serializer(self, *args, **kwargs):
|
||||||
|
@ -34,6 +34,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class='filter-list' id='filter-list-supplier-part'>
|
||||||
|
<!-- Empty div (will be filled out with available BOM filters) -->
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -122,6 +122,7 @@ function loadSupplierPartTable(table, url, options) {
|
|||||||
$(table).inventreeTable({
|
$(table).inventreeTable({
|
||||||
url: url,
|
url: url,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
original: params,
|
||||||
queryParams: filters,
|
queryParams: filters,
|
||||||
name: 'supplierparts',
|
name: 'supplierparts',
|
||||||
groupBy: false,
|
groupBy: false,
|
||||||
@ -135,6 +136,7 @@ function loadSupplierPartTable(table, url, options) {
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
field: 'part_detail.full_name',
|
field: 'part_detail.full_name',
|
||||||
title: '{% trans "Part" %}',
|
title: '{% trans "Part" %}',
|
||||||
|
switchable: false,
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row, index, field) {
|
||||||
|
|
||||||
var url = `/part/${row.part}/`;
|
var url = `/part/${row.part}/`;
|
||||||
|
@ -189,6 +189,15 @@ function getAvailableTableFilters(tableKey) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tableKey == 'supplier-part') {
|
||||||
|
return {
|
||||||
|
active: {
|
||||||
|
type: 'bool',
|
||||||
|
title: '{% trans "Active parts" %}',
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Filters for the "Parts" table
|
// Filters for the "Parts" table
|
||||||
if (tableKey == "parts") {
|
if (tableKey == "parts") {
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user