From c06046df8f05a778dee38ca4fa4da2f7e53f4677 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 11 Jun 2026 07:12:27 +0000 Subject: [PATCH] fix: added doctype filter validation for sales person wise transaction summary report (backport #55812) (#55818) Co-authored-by: Diptanil Saha fix: added doctype filter validation for sales person wise transaction summary report (#55812) --- .../sales_person_wise_transaction_summary.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py index f8cde141fe4..405159215cd 100644 --- a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py +++ b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py @@ -13,6 +13,8 @@ def execute(filters=None): if not filters: filters = {} + validate_filters(filters) + columns = get_columns(filters) entries = get_entries(filters) item_details = get_item_details() @@ -49,10 +51,17 @@ def execute(filters=None): return columns, data -def get_columns(filters): +def validate_filters(filters): + ALLOWED_DOCTYPES = ["Sales Order", "Sales Invoice", "Delivery Note"] + if not filters.get("doc_type"): msgprint(_("Please select the document type first"), raise_exception=1) + if filters.get("doc_type") not in ALLOWED_DOCTYPES: + frappe.throw(_("{0}, {1} or {2} are the only allowed options.").format(*ALLOWED_DOCTYPES)) + + +def get_columns(filters): columns = [ { "label": _(filters["doc_type"]),