add pos devices sharing informations to list of rancher inventories

This commit is contained in:
2025-08-31 15:35:46 +03:30
parent 27046f20e9
commit 11786cd2a5
3 changed files with 23 additions and 2 deletions

View File

@@ -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)