From 3e4bcfe2d8ba9d8640f178d928de07a429bb07a8 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Tue, 4 Jul 2017 10:49:37 +0530 Subject: [PATCH] [Fix] Opening Entry, Unknown column 'warehouse' in 'where clause' (#9585) * [Fix] Opening Entry, Unknown column 'warehouse' in 'where clause' * escaped company name in get_opening_accounts --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index a3de8da9a29..375d85d1b72 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -733,11 +733,10 @@ def get_opening_accounts(company): accounts = frappe.db.sql_list("""select name from tabAccount where - is_group=0 and - report_type='Balance Sheet' and - ifnull(warehouse, '') = '' and - company=%s - order by name asc""", company) + is_group=0 and report_type='Balance Sheet' and company=%s and + name not in(select distinct account from tabWarehouse where + account is not null and account != '') + order by name asc""", frappe.db.escape(company)) return [{"account": a, "balance": get_balance_on(a)} for a in accounts]