pos device transaction list
This commit is contained in:
@@ -72,8 +72,45 @@ class InventoryEntryViewSet(viewsets.ModelViewSet, DynamicSearchMixin, POSDevice
|
||||
return self.get_paginated_response(serializer.data)
|
||||
|
||||
|
||||
class InventoryQuotaSaleTransactionViewSet(viewsets.ModelViewSet):
|
||||
class InventoryQuotaSaleTransactionViewSet(viewsets.ModelViewSet, DynamicSearchMixin, POSDeviceMixin):
|
||||
queryset = warehouse_models.InventoryQuotaSaleTransaction.objects.all()
|
||||
serializer_class = warehouse_serializers.InventoryQuotaSaleTransactionSerializer
|
||||
filter_backends = [filters.SearchFilter]
|
||||
search_fields = ['']
|
||||
search_fields = [
|
||||
"rancher__union_name",
|
||||
"rancher__union_code",
|
||||
"rancher__first_name",
|
||||
"rancher__last_name",
|
||||
"rancher__national_code",
|
||||
"pos_device__device_identity",
|
||||
"pos_device__serial",
|
||||
"transaction_id",
|
||||
"seller_organization__name",
|
||||
"quota_distribution__distribution_id",
|
||||
"inventory_entry__distribution__distribution_id",
|
||||
"product__name",
|
||||
"transaction_status",
|
||||
]
|
||||
date_field = "create_date"
|
||||
|
||||
@action(
|
||||
methods=['get'],
|
||||
detail=False,
|
||||
url_path='transactions',
|
||||
url_name='transactions',
|
||||
name='transactions',
|
||||
)
|
||||
@transaction.atomic
|
||||
def transactions(self, request):
|
||||
""" pos transactions list """
|
||||
|
||||
# get device object
|
||||
device = self.get_pos_device()
|
||||
|
||||
queryset = self.queryset.filter(pos_device=device)
|
||||
queryset = self.filter_query(queryset)
|
||||
|
||||
# paginate & response
|
||||
page = self.paginate_queryset(queryset)
|
||||
if page is not None:
|
||||
serializer = self.get_serializer(page, many=True)
|
||||
return self.get_paginated_response(serializer.data)
|
||||
Reference in New Issue
Block a user