mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Filter SalesOrder by status
This commit is contained in:
parent
6ebce2b2fd
commit
fcd588cb01
@ -147,6 +147,11 @@ class SalesOrderStatus(StatusCode):
|
||||
RETURNED: 'yellow',
|
||||
}
|
||||
|
||||
# Open orders
|
||||
OPEN = [
|
||||
PENDING,
|
||||
]
|
||||
|
||||
|
||||
class StockStatus(StatusCode):
|
||||
|
||||
|
@ -13,7 +13,7 @@ from django.conf.urls import url, include
|
||||
|
||||
from InvenTree.helpers import str2bool
|
||||
from InvenTree.api import AttachmentMixin
|
||||
from InvenTree.status_codes import PurchaseOrderStatus
|
||||
from InvenTree.status_codes import PurchaseOrderStatus, SalesOrderStatus
|
||||
|
||||
from part.models import Part
|
||||
from company.models import SupplierPart
|
||||
@ -271,6 +271,17 @@ class SOList(generics.ListCreateAPIView):
|
||||
|
||||
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=SalesOrderStatus.OPEN)
|
||||
else:
|
||||
queryset = queryset.exclude(status__in=SalesOrderStatus.OPEN)
|
||||
|
||||
status = params.get('status', None)
|
||||
|
||||
if status is not None:
|
||||
|
@ -97,6 +97,10 @@ function getAvailableTableFilters(tableKey) {
|
||||
title: '{% trans "Order status" %}',
|
||||
options: salesOrderCodes,
|
||||
},
|
||||
outstanding: {
|
||||
type: 'bool',
|
||||
title: '{% trans "Outstanding" %}',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user