diff --git a/InvenTree/company/api.py b/InvenTree/company/api.py index 6e1e5c162d..50048eb322 100644 --- a/InvenTree/company/api.py +++ b/InvenTree/company/api.py @@ -89,7 +89,10 @@ class SupplierPartList(generics.ListCreateAPIView): def get_serializer(self, *args, **kwargs): # Do we wish to include extra detail? - part_detail = str2bool(self.request.GET.get('part_detail', None)) + try: + part_detail = str2bool(self.request.GET.get('part_detail', None)) + except AttributeError: + part_detail = None kwargs['part_detail'] = part_detail kwargs['context'] = self.get_serializer_context() diff --git a/InvenTree/part/api.py b/InvenTree/part/api.py index 4b1e449c08..f7b02ccfa4 100644 --- a/InvenTree/part/api.py +++ b/InvenTree/part/api.py @@ -273,8 +273,12 @@ class BomList(generics.ListCreateAPIView): def get_serializer(self, *args, **kwargs): # Do we wish to include extra detail? - part_detail = str2bool(self.request.GET.get('part_detail', None)) - sub_part_detail = str2bool(self.request.GET.get('sub_part_detail', None)) + try: + part_detail = str2bool(self.request.GET.get('part_detail', None)) + sub_part_detail = str2bool(self.request.GET.get('sub_part_detail', None)) + except AttributeError: + part_detail = None + sub_part_detail = None kwargs['part_detail'] = part_detail kwargs['sub_part_detail'] = sub_part_detail diff --git a/InvenTree/stock/api.py b/InvenTree/stock/api.py index 8240c6b837..8d08b8da7d 100644 --- a/InvenTree/stock/api.py +++ b/InvenTree/stock/api.py @@ -261,8 +261,12 @@ class StockList(generics.ListCreateAPIView): def get_serializer(self, *args, **kwargs): - part_detail = str2bool(self.request.GET.get('part_detail', None)) - location_detail = str2bool(self.request.GET.get('location_detail', None)) + try: + part_detail = str2bool(self.request.GET.get('part_detail', None)) + location_detail = str2bool(self.request.GET.get('location_detail', None)) + except AttributeError: + part_detail = None + location_detail = None kwargs['part_detail'] = part_detail kwargs['location_detail'] = location_detail