add & fix - transaction dashboard / edit distribution with stat validation bug

This commit is contained in:
2025-11-26 09:52:14 +03:30
parent 552813edd5
commit d63aa36a19
7 changed files with 209 additions and 8 deletions

View File

@@ -10,6 +10,7 @@ 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
from apps.warehouse.services.transaction_dashboard_service import TransactionDashboardService
from apps.warehouse.web.api.v1 import serializers as warehouse_serializers
from common.generics import base64_to_image_file
from common.helpers import get_organization_by_user
@@ -158,7 +159,13 @@ class InventoryEntryViewSet(BaseViewSet, SoftDeleteMixin, viewsets.ModelViewSet,
return self.get_paginated_response(serializer.data)
class InventoryQuotaSaleTransactionViewSet(BaseViewSet, SoftDeleteMixin, DynamicSearchMixin, viewsets.ModelViewSet):
class InventoryQuotaSaleTransactionViewSet(
BaseViewSet,
SoftDeleteMixin,
TransactionDashboardService,
DynamicSearchMixin,
viewsets.ModelViewSet,
):
queryset = warehouse_models.InventoryQuotaSaleTransaction.objects.all()
serializer_class = warehouse_serializers.InventoryQuotaSaleTransactionSerializer
filter_backends = [filters.SearchFilter]
@@ -212,6 +219,23 @@ class InventoryQuotaSaleTransactionViewSet(BaseViewSet, SoftDeleteMixin, Dynamic
serializer = self.get_serializer(page, many=True)
return self.get_paginated_response(serializer.data)
@action(
methods=['get'],
detail=False,
url_path='transactions_dashboard',
url_name='transactions_dashboard',
name='transactions_dashboard'
)
def transactions_dashboard(self, request):
"""
dashboard of full detail of all my transactions
"""
org = get_organization_by_user(request.user)
transaction_dashboard_data = self.get_dashboard(org)
return Response(transaction_dashboard_data, status=status.HTTP_200_OK)
class InventoryQuotaSaleItemViewSet(SoftDeleteMixin, BaseViewSet, viewsets.ModelViewSet):
queryset = warehouse_models.InventoryQuotaSaleItem.objects.all()