fix(report): iterate on accounts only when accounts exist (#26390)

This commit is contained in:
Afshan 2021-07-12 11:10:00 +05:30 committed by GitHub
parent 6467632f60
commit 4b4ac7c051
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,13 +48,12 @@ def validate_filters(filters, account_details):
if not filters.get("from_date") and not filters.get("to_date"):
frappe.throw(_("{0} and {1} are mandatory").format(frappe.bold(_("From Date")), frappe.bold(_("To Date"))))
for account in filters.account:
if not account_details.get(account):
frappe.throw(_("Account {0} does not exists").format(account))
if filters.get('account'):
filters.account = frappe.parse_json(filters.get('account'))
for account in filters.account:
if not account_details.get(account):
frappe.throw(_("Account {0} does not exists").format(account))
if (filters.get("account") and filters.get("group_by") == _('Group by Account')
and account_details[filters.account].is_group == 0):