mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add ability to filter purchase orders by "outstanding" status
This commit is contained in:
parent
544e217347
commit
6ebce2b2fd
@ -13,6 +13,7 @@ from django.conf.urls import url, include
|
|||||||
|
|
||||||
from InvenTree.helpers import str2bool
|
from InvenTree.helpers import str2bool
|
||||||
from InvenTree.api import AttachmentMixin
|
from InvenTree.api import AttachmentMixin
|
||||||
|
from InvenTree.status_codes import PurchaseOrderStatus
|
||||||
|
|
||||||
from part.models import Part
|
from part.models import Part
|
||||||
from company.models import SupplierPart
|
from company.models import SupplierPart
|
||||||
@ -68,6 +69,17 @@ class POList(generics.ListCreateAPIView):
|
|||||||
|
|
||||||
params = self.request.query_params
|
params = self.request.query_params
|
||||||
|
|
||||||
|
# Filter by 'outstanding' status
|
||||||
|
outstanding = params.get('outstanding', None)
|
||||||
|
|
||||||
|
if outstanding is not None:
|
||||||
|
outstanding = str2bool(outstanding)
|
||||||
|
|
||||||
|
if outstanding:
|
||||||
|
queryset = queryset.filter(status__in=PurchaseOrderStatus.OPEN)
|
||||||
|
else:
|
||||||
|
queryset = queryset.exclude(status__in=PurchaseOrderStatus.OPEN)
|
||||||
|
|
||||||
# Special filtering for 'status' field
|
# Special filtering for 'status' field
|
||||||
status = params.get('status', None)
|
status = params.get('status', None)
|
||||||
|
|
||||||
|
@ -78,11 +78,16 @@ function getAvailableTableFilters(tableKey) {
|
|||||||
|
|
||||||
// Filters for the "Order" table
|
// Filters for the "Order" table
|
||||||
if (tableKey == "purchaseorder") {
|
if (tableKey == "purchaseorder") {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
status: {
|
status: {
|
||||||
title: '{% trans "Order status" %}',
|
title: '{% trans "Order status" %}',
|
||||||
options: purchaseOrderCodes,
|
options: purchaseOrderCodes,
|
||||||
},
|
},
|
||||||
|
outstanding: {
|
||||||
|
type: 'bool',
|
||||||
|
title: '{% trans "Outstanding" %}',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user