fix: code improvement, match error type for message

This commit is contained in:
Abhishek Balam 2020-11-04 23:42:08 +05:30
parent 5fe3abcfae
commit 5db99e0649
2 changed files with 5 additions and 7 deletions

View File

@ -92,7 +92,7 @@ frappe.ui.form.on('Process Statement Of Accounts', {
frm.refresh_field('customers');
}
else{
frappe.msgprint('No Customers found with selected options.');
frappe.throw('No Customers found with selected options.');
}
}
}

View File

@ -126,13 +126,11 @@ def get_customers_based_on_sales_person(sales_person):
sales_person_records = frappe._dict()
for d in records:
sales_person_records.setdefault(d.parenttype, set()).add(d.parent)
try:
customers = frappe.get_list('Customer', fields=['name', 'email_id'], \
if sales_person_records.get('Customer'):
return frappe.get_list('Customer', fields=['name', 'email_id'], \
filters=[['name', 'in', list(sales_person_records['Customer'])]])
except:
customers = []
return customers
else:
return []
def get_recipients_and_cc(customer, doc):
recipients = []