fix --> bug of transaction dashboard on free visibility scope

This commit is contained in:
2026-02-02 10:36:35 +03:30
parent 93180edc0b
commit f798b72dbc

View File

@@ -280,25 +280,30 @@ class InventoryQuotaSaleTransactionViewSet(
transaction_status = query_param.get('status') if 'status' in query_param.keys() else None
org = get_organization_by_user(request.user)
# if org.free_visibility_by_scope:
# tr_objects = self.get_queryset(visibility_by_org_scope=True)
# tr_item_objects = InventoryQuotaSaleItemViewSet().get_queryset(visibility_by_org_scope=True)
# transaction_dashboard_data = self.get_dashboard(
# org,
# free_visibility_tr_objects=tr_objects,
# free_visibility_tr_item_objects=tr_item_objects,
# start_date=start_date,
# end_date=end_date,
# status=transaction_status,
# )
# else:
# filer by date & transaction status
transaction_dashboard_data = self.get_dashboard(
org,
start_date=start_date,
end_date=end_date,
status=transaction_status,
)
if org.free_visibility_by_scope:
tr_objects = self.get_queryset(visibility_by_org_scope=True)
tr_item_view = InventoryQuotaSaleItemViewSet()
tr_item_view.request = request
tr_item_objects = tr_item_view.get_queryset(visibility_by_org_scope=True)
transaction_dashboard_data = self.get_dashboard(
org,
free_visibility_tr_objects=tr_objects,
free_visibility_tr_item_objects=tr_item_objects,
start_date=start_date,
end_date=end_date,
status=transaction_status,
)
else:
# filer by date & transaction status
transaction_dashboard_data = self.get_dashboard(
org,
start_date=start_date,
end_date=end_date,
status=transaction_status,
)
return Response(transaction_dashboard_data, status=status.HTTP_200_OK)