From 589f2cd16c1051504c01743ead56a65ef6deea78 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Mon, 3 Feb 2020 15:49:24 +0530 Subject: [PATCH] fix: Get only specified company accounts in financial statements (#20486) --- erpnext/accounts/report/financial_statements.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index 30c012e9e7..96f78f9321 100644 --- a/erpnext/accounts/report/financial_statements.py +++ b/erpnext/accounts/report/financial_statements.py @@ -348,7 +348,8 @@ def set_gl_entries_by_account( additional_conditions = get_additional_conditions(from_date, ignore_closing_entries, filters) accounts = frappe.db.sql_list("""select name from `tabAccount` - where lft >= %s and rgt <= %s""", (root_lft, root_rgt)) + where lft >= %s and rgt <= %s and company = %s""", (root_lft, root_rgt, company)) + additional_conditions += " and account in ({})"\ .format(", ".join([frappe.db.escape(d) for d in accounts]))