Add a "sales_order" reference to the Build model

- If a build order is made to fulfil a sales order
- Add sales_order filtering to the Build API
- Pass initial information through to the BuildCreate view
This commit is contained in:
Oliver Walters committed 2020-04-25 13:15:45 +10:00
1 parent b351976ae9
commit d5f3498238
8 files changed
+96 -29

No files matched your search

+2 -6
View File
@@ -38,6 +38,8 @@ class BuildList(generics.ListCreateAPIView):
]
filter_fields = [
'part',
'sales_order',
]
def get_queryset(self):
@@ -48,12 +50,6 @@ class BuildList(generics.ListCreateAPIView):
build_list = super().get_queryset()
# Filter by part
part = self.request.query_params.get('part', None)
if part is not None:
build_list = build_list.filter(part=part)
# Filter by build status?
status = self.request.query_params.get('status', None)