add pos devices sharing informations to list of rancher inventories
This commit is contained in:
@@ -60,6 +60,7 @@ class InventoryEntryViewSet(viewsets.ModelViewSet, DynamicSearchMixin, POSDevice
|
||||
def rancher_inventory_entries(self, request):
|
||||
""" """
|
||||
organization = self.get_device_organization()
|
||||
device = self.get_pos_device()
|
||||
rancher = Rancher.objects.filter(national_code=request.GET['national_code']).first()
|
||||
entries = self.queryset.filter(organization=organization)
|
||||
|
||||
@@ -68,7 +69,7 @@ class InventoryEntryViewSet(viewsets.ModelViewSet, DynamicSearchMixin, POSDevice
|
||||
# paginate & response
|
||||
page = self.paginate_queryset(available_entries)
|
||||
if page is not None:
|
||||
serializer = self.get_serializer(page, many=True, context={'rancher': rancher})
|
||||
serializer = self.get_serializer(page, many=True, context={'rancher': rancher, 'device': device})
|
||||
return self.get_paginated_response(serializer.data)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user