fix: Do not show any finance book record if no finance book filter is applied
diff --git a/erpnext/accounts/report/cash_flow/cash_flow.py b/erpnext/accounts/report/cash_flow/cash_flow.py
index 0b12477..702c81c 100644
--- a/erpnext/accounts/report/cash_flow/cash_flow.py
+++ b/erpnext/accounts/report/cash_flow/cash_flow.py
@@ -136,6 +136,8 @@
cond = """ AND (finance_book in (%s, %s, '') OR finance_book IS NULL)
""" %(frappe.db.escape(filters.finance_book), frappe.db.escape(company_fb))
+ else:
+ cond = "AND (finance_book = '' OR finance_book IS NULL)"
gl_sum = frappe.db.sql_list("""
select sum(credit) - sum(debit)
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index 32d9075..a1ecaae 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -13,7 +13,7 @@
from erpnext.accounts.report.utils import get_currency, convert_to_presentation_currency
from erpnext.accounts.utils import get_fiscal_year
from frappe import _
-from frappe.utils import (flt, getdate, get_first_day, add_months, add_days, formatdate)
+from frappe.utils import (flt, getdate, get_first_day, add_months, add_days, formatdate, cstr)
from six import itervalues
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
@@ -356,7 +356,7 @@
"company": company,
"from_date": from_date,
"to_date": to_date,
- "finance_book": filters.get("finance_book")
+ "finance_book": cstr(filters.get("finance_book"))
}
if filters.get("include_default_book_entries"):
@@ -411,6 +411,8 @@
additional_conditions.append("(finance_book in (%(finance_book)s, %(company_fb)s, '') OR finance_book IS NULL)")
else:
additional_conditions.append("(finance_book in (%(finance_book)s, '') OR finance_book IS NULL)")
+ else:
+ additional_conditions.append("(finance_book = '' OR finance_book IS NULL)")
if accounting_dimensions:
for dimension in accounting_dimensions: