Merge pull request #20521 from deepeshgarg007/fixnancial_query_fix_v12

fix: SQL query in financial statements
This commit is contained in:
Deepesh Garg
2020-02-05 12:33:06 +05:30
committed by GitHub

View File

@@ -348,7 +348,9 @@ def set_gl_entries_by_account(
additional_conditions = get_additional_conditions(from_date, ignore_closing_entries, filters) additional_conditions = get_additional_conditions(from_date, ignore_closing_entries, filters)
accounts = frappe.db.sql_list("""select name from `tabAccount` 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))
if accounts:
additional_conditions += " and account in ({})"\ additional_conditions += " and account in ({})"\
.format(", ".join([frappe.db.escape(d) for d in accounts])) .format(", ".join([frappe.db.escape(d) for d in accounts]))