diff --git a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js index a01cc0f943..a0e56ded96 100644 --- a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js +++ b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js @@ -7,12 +7,14 @@ frappe.query_reports["Sales Payment Summary"] = { "label": __("From Date"), "fieldtype": "Date", "default": frappe.datetime.get_today(), + "reqd": 1, "width": "80" }, { "fieldname":"to_date", "label": __("To Date"), "fieldtype": "Date", + "reqd": 1, "default": frappe.datetime.get_today() }, { diff --git a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py index b46f1bea0f..3fcc1d3170 100644 --- a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py +++ b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py @@ -37,11 +37,11 @@ def get_sales_payment_data(filters, columns): def get_conditions(filters): conditions = "" - if filters.get("company"): conditions += " a.company=%(company)s" + if filters.get("from_date"): conditions += "a.posting_date >= %(from_date)s" + if filters.get("to_date"): conditions += " and a.posting_date <= %(to_date)s" + if filters.get("company"): conditions += " and a.company=%(company)s" if filters.get("customer"): conditions += " and a.customer = %(customer)s" if filters.get("owner"): conditions += " and a.owner = %(owner)s" - if filters.get("from_date"): conditions += " and a.posting_date >= %(from_date)s" - if filters.get("to_date"): conditions += " and a.posting_date <= %(to_date)s" if filters.get("is_pos"): conditions += " and a.is_pos = %(is_pos)s" return conditions