Account validated in general ledger report. Fixed #1912

This commit is contained in:
nabinhait 2014-07-09 11:08:59 +05:30
parent 5220b462fd
commit 5eea6f1b6d

View File

@ -63,6 +63,8 @@ def get_gl_entries(filters):
def get_conditions(filters): def get_conditions(filters):
conditions = [] conditions = []
if filters.get("account"): if filters.get("account"):
if not frappe.db.exists("Account", filters["account"]):
frappe.throw(_("Account {0} is not valid").format(filters["account"]))
lft, rgt = frappe.db.get_value("Account", filters["account"], ["lft", "rgt"]) lft, rgt = frappe.db.get_value("Account", filters["account"], ["lft", "rgt"])
conditions.append("""account in (select name from tabAccount conditions.append("""account in (select name from tabAccount
where lft>=%s and rgt<=%s and docstatus<2)""" % (lft, rgt)) where lft>=%s and rgt<=%s and docstatus<2)""" % (lft, rgt))