fix: filter by accounts with group by accounts (#26438)

* fix: filter by accounts with group by accounts

* fix: parsing json

Co-authored-by: Saqib <nextchamp.saqib@gmail.com>
This commit is contained in:
Afshan 2021-07-14 19:59:11 +05:30 committed by GitHub
parent 30905e24e0
commit 74d7baa80a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,9 +55,11 @@ def validate_filters(filters, account_details):
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):
frappe.throw(_("Can not filter based on Account, if grouped by Account"))
if (filters.get("account") and filters.get("group_by") == _('Group by Account')):
filters.account = frappe.parse_json(filters.get('account'))
for account in filters.account:
if account_details[account].is_group == 0:
frappe.throw(_("Can not filter based on Child Account, if grouped by Account"))
if (filters.get("voucher_no")
and filters.get("group_by") in [_('Group by Voucher')]):