From beee98da6d46732b7ab0cd324a75b9262473a444 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Wed, 3 Jan 2024 10:03:27 +0530 Subject: [PATCH] feat: Against voucher filter in General Ledger (#39100) --- erpnext/accounts/report/general_ledger/general_ledger.js | 5 +++++ erpnext/accounts/report/general_ledger/general_ledger.py | 3 +++ erpnext/controllers/accounts_controller.py | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/erpnext/accounts/report/general_ledger/general_ledger.js b/erpnext/accounts/report/general_ledger/general_ledger.js index 4cb443cf92..79b5e4d9ec 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.js +++ b/erpnext/accounts/report/general_ledger/general_ledger.js @@ -52,6 +52,11 @@ frappe.query_reports["General Ledger"] = { frappe.query_report.set_filter_value('group_by', "Group by Voucher (Consolidated)"); } }, + { + "fieldname":"against_voucher_no", + "label": __("Against Voucher No"), + "fieldtype": "Data", + }, { "fieldtype": "Break", }, diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py index 4054dca360..6636b8e042 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.py +++ b/erpnext/accounts/report/general_ledger/general_ledger.py @@ -238,6 +238,9 @@ def get_conditions(filters): if filters.get("voucher_no"): conditions.append("voucher_no=%(voucher_no)s") + if filters.get("against_voucher_no"): + conditions.append("against_voucher=%(against_voucher_no)s") + if filters.get("voucher_no_not_in"): conditions.append("voucher_no not in %(voucher_no_not_in)s") diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 13df9d591c..de7a7f9da4 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -933,6 +933,12 @@ class AccountsController(TransactionBase): } ) + if not args.get("against_voucher_type") and self.get("against_voucher_type"): + gl_dict.update({"against_voucher_type": self.get("against_voucher_type")}) + + if not args.get("against_voucher") and self.get("against_voucher"): + gl_dict.update({"against_voucher": self.get("against_voucher")}) + return gl_dict def get_voucher_subtype(self):