diff --git a/InvenTree/stock/api.py b/InvenTree/stock/api.py index 909900a0b4..0c045f1cf5 100644 --- a/InvenTree/stock/api.py +++ b/InvenTree/stock/api.py @@ -72,7 +72,7 @@ class StockDetail(generics.RetrieveUpdateDestroyAPIView): def get_serializer_context(self): ctx = super().get_serializer_context() - ctx['user'] = self.request.user + ctx['user'] = getattr(self.request, 'user', None) return ctx @@ -392,7 +392,7 @@ class StockList(generics.ListCreateAPIView): def get_serializer_context(self): ctx = super().get_serializer_context() - ctx['user'] = self.request.user + ctx['user'] = getattr(self.request, 'user', None) return ctx