mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-15 15:38:39 +00:00
fix: added doctype filter validation for sales person wise transaction summary report (backport #55812) (#55818)
Co-authored-by: Diptanil Saha <diptanil@frappe.io> fix: added doctype filter validation for sales person wise transaction summary report (#55812)
This commit is contained in:
@@ -13,6 +13,8 @@ def execute(filters=None):
|
|||||||
if not filters:
|
if not filters:
|
||||||
filters = {}
|
filters = {}
|
||||||
|
|
||||||
|
validate_filters(filters)
|
||||||
|
|
||||||
columns = get_columns(filters)
|
columns = get_columns(filters)
|
||||||
entries = get_entries(filters)
|
entries = get_entries(filters)
|
||||||
item_details = get_item_details()
|
item_details = get_item_details()
|
||||||
@@ -49,10 +51,17 @@ def execute(filters=None):
|
|||||||
return columns, data
|
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"):
|
if not filters.get("doc_type"):
|
||||||
msgprint(_("Please select the document type first"), raise_exception=1)
|
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 = [
|
columns = [
|
||||||
{
|
{
|
||||||
"label": _(filters["doc_type"]),
|
"label": _(filters["doc_type"]),
|
||||||
|
|||||||
Reference in New Issue
Block a user