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,10 +78,7 @@ def validate_filters(filters, account_details):
def validate_party(filters): def validate_party(filters):
party_type, party = filters.get("party_type"), filters.get("party") party_type, party = filters.get("party_type"), filters.get("party")
if party: if party and party_type:
if not party_type:
frappe.throw(_("To filter based on Party, select Party Type first"))
else:
for d in party: for d in party:
if not frappe.db.exists(party_type, d): if not frappe.db.exists(party_type, d):
frappe.throw(_("Invalid {0}: {1}").format(party_type, d)) frappe.throw(_("Invalid {0}: {1}").format(party_type, d))