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)
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ from apps.product.services.services import (
|
||||
quota_brokers_value,
|
||||
quota_attribute_value
|
||||
)
|
||||
from apps.pos_device.services.services import pos_organizations_sharing_information
|
||||
from apps.pos_device.pos.api.v1.serializers.device import DeviceSerializer
|
||||
from apps.herd.pos.api.v1.serializers import RancherSerializer
|
||||
from apps.warehouse.exceptions import (
|
||||
@@ -61,7 +62,8 @@ class InventoryEntrySerializer(serializers.ModelSerializer):
|
||||
|
||||
representation['pricing'] = {
|
||||
'brokers_info': quota_brokers_value(instance.distribution.quota),
|
||||
'pricing_attributes': quota_attribute_value(instance.distribution.quota)
|
||||
'pricing_attributes': quota_attribute_value(instance.distribution.quota),
|
||||
'sharing': pos_organizations_sharing_information(self.context['device'])
|
||||
}
|
||||
|
||||
if 'rancher' in self.context.keys():
|
||||
|
||||
Reference in New Issue
Block a user