From 9a89926095fc108712a15234c485d483e85af188 Mon Sep 17 00:00:00 2001 From: Mojtaba-z Date: Sat, 29 Nov 2025 12:05:21 +0330 Subject: [PATCH] fix - transaction dashboard items filter --- .../services/transaction_dashboard_service.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/warehouse/services/transaction_dashboard_service.py b/apps/warehouse/services/transaction_dashboard_service.py index adbd678..c8de24f 100644 --- a/apps/warehouse/services/transaction_dashboard_service.py +++ b/apps/warehouse/services/transaction_dashboard_service.py @@ -31,7 +31,7 @@ class TransactionDashboardService: transaction__seller_organization__in=orgs_child ).select_related("gov_product", "free_product") - # filter queryset by date + # filter queryset (transactions & items) by date if start_date and end_date: transactions = DynamicSearchService( queryset=transactions, @@ -40,9 +40,17 @@ class TransactionDashboardService: date_field="create_date", ).apply() + items = DynamicSearchService( + queryset=items, + start=start_date, + end=end_date, + date_field="create_date", + ).apply() + # filer by transaction status if status: transactions = transactions.filter(transaction_status=status) + items = items.filter(transaction__transaction_status=status) transaction_stats = transactions.aggregate( total_transactions=Count("id"),