From 921584c769aea54be6dbc23c41007f8aa4b8b9a3 Mon Sep 17 00:00:00 2001 From: Smit Vora Date: Tue, 3 Feb 2026 16:03:14 +0530 Subject: [PATCH] fix: Period Closing Voucher doesn't exist for GL Entry (cherry picked from commit b41c1858a39f98c5576bbaedfdf0354d4588ff48) --- .../financial_report_engine.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/financial_report_template/financial_report_engine.py b/erpnext/accounts/doctype/financial_report_template/financial_report_engine.py index ce8ed4adb07..216a9034be4 100644 --- a/erpnext/accounts/doctype/financial_report_template/financial_report_engine.py +++ b/erpnext/accounts/doctype/financial_report_template/financial_report_engine.py @@ -541,7 +541,7 @@ class FinancialQueryBuilder: .where(acb_table.period_closing_voucher == closing_voucher) ) - query = self._apply_standard_filters(query, acb_table) + query = self._apply_standard_filters(query, acb_table, "Account Closing Balance") results = self._execute_with_permissions(query, "Account Closing Balance") for row in results: @@ -679,12 +679,12 @@ class FinancialQueryBuilder: else: account_data.unaccumulate_values() - def _apply_standard_filters(self, query, table): + def _apply_standard_filters(self, query, table, doctype: str = "GL Entry"): if self.filters.get("ignore_closing_entries"): - if hasattr(table, "is_period_closing_voucher_entry"): - query = query.where(table.is_period_closing_voucher_entry == 0) - else: + if doctype == "GL Entry": query = query.where(table.voucher_type != "Period Closing Voucher") + else: + query = query.where(table.is_period_closing_voucher_entry == 0) if self.filters.get("project"): projects = self.filters.get("project")