From e99425b7c47afc0e9395f39e1b06ca70477f9cb2 Mon Sep 17 00:00:00 2001 From: Shllokkk Date: Fri, 24 Jul 2026 15:32:51 +0530 Subject: [PATCH 1/2] fix: rename misleading filter labels in AR/AP reports --- .../accounts/report/accounts_payable/accounts_payable.js | 8 ++++---- .../accounts_payable_summary/accounts_payable_summary.js | 8 ++++---- .../report/accounts_receivable/accounts_receivable.js | 8 ++++---- .../report/accounts_receivable/accounts_receivable.py | 3 +-- .../accounts_receivable_summary.js | 8 ++++---- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.js b/erpnext/accounts/report/accounts_payable/accounts_payable.js index f0bca38d443..b26a6c78aa9 100644 --- a/erpnext/accounts/report/accounts_payable/accounts_payable.js +++ b/erpnext/accounts/report/accounts_payable/accounts_payable.js @@ -13,7 +13,7 @@ frappe.query_reports["Accounts Payable"] = { }, { fieldname: "report_date", - label: __("Posting Date"), + label: __("Report Date"), fieldtype: "Date", default: frappe.datetime.get_today(), }, @@ -69,10 +69,10 @@ frappe.query_reports["Accounts Payable"] = { default: "Due Date", }, { - fieldname: "calculate_ageing_with", - label: __("Calculate Ageing With"), + fieldname: "age_as_on", + label: __("Age as on"), fieldtype: "Select", - options: "Report Date\nToday Date", + options: "Report Date\nToday", default: "Report Date", }, { diff --git a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js index 72fb564cf9e..db30b68b9a6 100644 --- a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js +++ b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js @@ -12,7 +12,7 @@ frappe.query_reports["Accounts Payable Summary"] = { }, { fieldname: "report_date", - label: __("Posting Date"), + label: __("Report Date"), fieldtype: "Date", default: frappe.datetime.get_today(), }, @@ -24,10 +24,10 @@ frappe.query_reports["Accounts Payable Summary"] = { default: "Due Date", }, { - fieldname: "calculate_ageing_with", - label: __("Calculate Ageing With"), + fieldname: "age_as_on", + label: __("Age as on"), fieldtype: "Select", - options: "Report Date\nToday Date", + options: "Report Date\nToday", default: "Report Date", }, { diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js index 4a6ef4dd86a..7e4fbdaded0 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js @@ -15,7 +15,7 @@ frappe.query_reports["Accounts Receivable"] = { }, { fieldname: "report_date", - label: __("Posting Date"), + label: __("Report Date"), fieldtype: "Date", default: frappe.datetime.get_today(), }, @@ -98,10 +98,10 @@ frappe.query_reports["Accounts Receivable"] = { default: "Due Date", }, { - fieldname: "calculate_ageing_with", - label: __("Calculate Ageing With"), + fieldname: "age_as_on", + label: __("Age as on"), fieldtype: "Select", - options: "Report Date\nToday Date", + options: "Report Date\nToday", default: "Report Date", }, { diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index bb07fee6c66..a6cdb823cac 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -54,8 +54,7 @@ class ReceivablePayableReport: self.filters.report_date = getdate(self.filters.report_date or nowdate()) self.age_as_on = ( getdate(nowdate()) - if "calculate_ageing_with" not in self.filters - or self.filters.calculate_ageing_with == "Today Date" + if "age_as_on" not in self.filters or self.filters.age_as_on == "Today" else self.filters.report_date ) diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js index e71638a59e4..22a5182a41c 100644 --- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js +++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js @@ -12,7 +12,7 @@ frappe.query_reports["Accounts Receivable Summary"] = { }, { fieldname: "report_date", - label: __("Posting Date"), + label: __("Report Date"), fieldtype: "Date", default: frappe.datetime.get_today(), }, @@ -24,10 +24,10 @@ frappe.query_reports["Accounts Receivable Summary"] = { default: "Due Date", }, { - fieldname: "calculate_ageing_with", - label: __("Calculate Ageing With"), + fieldname: "age_as_on", + label: __("Age as on"), fieldtype: "Select", - options: "Report Date\nToday Date", + options: "Report Date\nToday", default: "Report Date", }, { From f13cd004945207d724f967b490c6a5952fb7ad15 Mon Sep 17 00:00:00 2001 From: Shllokkk Date: Fri, 24 Jul 2026 18:45:07 +0530 Subject: [PATCH 2/2] fix: migrate stored AR/AP ageing filter to renamed field --- erpnext/patches.txt | 1 + .../v16_0/rename_ar_ap_ageing_filter.py | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 erpnext/patches/v16_0/rename_ar_ap_ageing_filter.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 4bc36ce882e..be5b8202821 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -502,3 +502,4 @@ erpnext.patches.v16_0.access_control_for_project_users erpnext.patches.v16_0.enable_book_stock_expense_gl_entries execute:frappe.db.set_single_value("Stock Settings", "use_inline_serial_batch_editor", 0) erpnext.patches.v16_0.recompute_production_plan_reserved_qty +erpnext.patches.v16_0.rename_ar_ap_ageing_filter diff --git a/erpnext/patches/v16_0/rename_ar_ap_ageing_filter.py b/erpnext/patches/v16_0/rename_ar_ap_ageing_filter.py new file mode 100644 index 00000000000..8252c3b0aac --- /dev/null +++ b/erpnext/patches/v16_0/rename_ar_ap_ageing_filter.py @@ -0,0 +1,45 @@ +import frappe + +REPORTS = ( + "Accounts Receivable", + "Accounts Payable", + "Accounts Receivable Summary", + "Accounts Payable Summary", +) + + +def execute(): + # filter `calculate_ageing_with` -> `age_as_on`, option "Today Date" -> "Today" + _migrate("Auto Email Report", "filters", "report") + _migrate("Dashboard Chart", "filters_json", "report_name", type_field="chart_type") + _migrate("Number Card", "filters_json", "report_name", type_field="type") + + +def _migrate(doctype, filter_field, report_field, type_field=None): + conditions = {report_field: ("in", REPORTS)} + if type_field: + conditions[type_field] = "Report" + + for row in frappe.get_all(doctype, filters=conditions, fields=["name", filter_field]): + updated = _rewrite(row.get(filter_field)) + if updated is not None: + frappe.db.set_value(doctype, row.name, filter_field, updated, update_modified=False) + + +def _rewrite(raw): + if not raw: + return None + + try: + filters = frappe.parse_json(raw) + except ValueError: + return None + + if not isinstance(filters, dict) or "calculate_ageing_with" not in filters: + return None + + filters["age_as_on"] = filters.pop("calculate_ageing_with") + if filters["age_as_on"] == "Today Date": + filters["age_as_on"] = "Today" + + return frappe.as_json(filters, indent=None)