fix - transaction & show users with my organization except me

This commit is contained in:
2025-11-01 14:20:27 +03:30
parent 0f6e1ecd28
commit f8320b6e44
4 changed files with 50 additions and 12 deletions

View File

@@ -6,6 +6,7 @@ from rest_framework import viewsets, filters
from rest_framework.decorators import action
from rest_framework.response import Response
from apps.core.api import BaseViewSet
from apps.core.mixins.search_mixin import DynamicSearchMixin
from apps.core.mixins.soft_delete_mixin import SoftDeleteMixin
from apps.warehouse import models as warehouse_models
@@ -124,15 +125,40 @@ class InventoryEntryViewSet(SoftDeleteMixin, viewsets.ModelViewSet, DynamicSearc
return self.get_paginated_response(serializer.data)
class InventoryQuotaSaleTransactionViewSet(SoftDeleteMixin, viewsets.ModelViewSet):
class InventoryQuotaSaleTransactionViewSet(SoftDeleteMixin, DynamicSearchMixin, BaseViewSet, viewsets.ModelViewSet):
queryset = warehouse_models.InventoryQuotaSaleTransaction.objects.all()
serializer_class = warehouse_serializers.InventoryQuotaSaleTransactionSerializer
filter_backends = [filters.SearchFilter]
search_fields = ['']
search_fields = [
'rancher_fullname', 'rancher_mobile', 'pos_device__device_identity',
'pos_device__acceptor', 'pos_device__terminal', 'pos_device__serial',
'items__gov_product__name', 'items__free_product__name', 'items__name',
'items__item_type', 'items__unit', 'transaction_id', 'seller_organization__name',
'quota_distribution__distribution_id', 'weight', 'delivery_address', 'transaction_price',
'price_paid', 'price_type', 'product_type', 'transactions_number', 'transaction_status',
'transaction_status_code', 'ref_num', 'terminal', 'payer_cart', 'transaction_date',
]
def list(self, request, *args, **kwargs):
"""
list of transactions
filter by: search, all, my_transactions
"""
queryset = self.filter_query(self.get_queryset())
class InventoryQuotaSaleItemViewSet(SoftDeleteMixin, viewsets.ModelViewSet):
class InventoryQuotaSaleItemViewSet(SoftDeleteMixin, BaseViewSet, viewsets.ModelViewSet):
queryset = warehouse_models.InventoryQuotaSaleItem.objects.all()
serializer_class = warehouse_serializers.InventoryQuotaSaleItemSerializer
filter_backends = [filters.SearchFilter]
search_fields = ['']
search_fields = [
'transaction',
'quota_distribution',
'gov_product',
'free_product',
'name',
'price_type',
'delivery_type',
'paid_type',
'item_type',
'unit',
]