From 91eac5a7cf1dc9ee25384a3de3470b9f8411d405 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 22 Oct 2018 15:04:57 +0530 Subject: [PATCH 1/2] fix(report): Optimization for financial statements --- erpnext/accounts/report/financial_statements.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index 1be3d74185..459f492289 100644 --- a/erpnext/accounts/report/financial_statements.py +++ b/erpnext/accounts/report/financial_statements.py @@ -306,19 +306,20 @@ def set_gl_entries_by_account(company, from_date, to_date, root_lft, root_rgt, f 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)) + additional_conditions += " and account in ('{}')"\ + .format("', '".join([frappe.db.escape(d) for d in accounts])) + gl_entries = frappe.db.sql("""select posting_date, account, debit, credit, is_opening, fiscal_year from `tabGL Entry` where company=%(company)s {additional_conditions} and posting_date <= %(to_date)s - and account in (select name from `tabAccount` - where lft >= %(lft)s and rgt <= %(rgt)s) order by account, posting_date""".format(additional_conditions=additional_conditions), { "company": company, "from_date": from_date, "to_date": to_date, - "lft": root_lft, - "rgt": root_rgt }, as_dict=True) From c365ce8f2146da4d5c65e49207cb1bf1a6ba982a Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Mon, 22 Oct 2018 10:34:35 +0000 Subject: [PATCH 2/2] bumped to version 10.1.62 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index d44bf40a9f..ec3f371a15 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.1.61' +__version__ = '10.1.62' def get_default_company(user=None): '''Get default company for user'''