fix: validate party and party type only if both available (#27002)

* fix: validate party and party type only if both available

* fix: indentation
This commit is contained in:
Afshan 2021-08-25 11:57:24 +05:30 committed by GitHub
parent 1dadea38a5
commit 8366b6322e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,13 +78,10 @@ def validate_filters(filters, account_details):
def validate_party(filters):
party_type, party = filters.get("party_type"), filters.get("party")
if party:
if not party_type:
frappe.throw(_("To filter based on Party, select Party Type first"))
else:
for d in party:
if not frappe.db.exists(party_type, d):
frappe.throw(_("Invalid {0}: {1}").format(party_type, d))
if party and party_type:
for d in party:
if not frappe.db.exists(party_type, d):
frappe.throw(_("Invalid {0}: {1}").format(party_type, d))
def set_account_currency(filters):
if filters.get("account") or (filters.get('party') and len(filters.party) == 1):