diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py index bb90be4f85..03626cdc5c 100755 --- a/erpnext/hr/doctype/employee/employee.py +++ b/erpnext/hr/doctype/employee/employee.py @@ -294,6 +294,8 @@ def get_employee_emails(employee_list): '''Returns list of employee emails either based on user_id or company_email''' employee_emails = [] for employee in employee_list: + if not employee: + continue user, email = frappe.db.get_value('Employee', employee, ['user_id', 'company_email']) if user or email: employee_emails.append(user or email) diff --git a/erpnext/hr/doctype/training_event/test_training_event.js b/erpnext/hr/doctype/training_event/test_training_event.js index 62264f3692..500437c732 100644 --- a/erpnext/hr/doctype/training_event/test_training_event.js +++ b/erpnext/hr/doctype/training_event/test_training_event.js @@ -11,20 +11,24 @@ QUnit.test("test: Training Event", function (assert) { () => frappe.new_doc("Training Event"), () => frappe.timeout(1), () => frappe.click_link('Edit in full page'), - () => cur_frm.set_value("event_name", "Test Event"), + () => cur_frm.set_value("event_name", "Test Event " + frappe.utils.get_random(10)), () => cur_frm.set_value("start_time", "2017-07-26, 2:00 pm PDT"), () => cur_frm.set_value("end_time", "2017-07-26, 2:30 pm PDT"), () => cur_frm.set_value("introduction", "This is a test report"), () => cur_frm.set_value("location", "Fake office"), - () => cur_frm.set_value("send_email", 0), () => frappe.click_button('Add Row'), + () => frappe.db.get_value('Employee', {'employee_name':'Test Employee 1'}, 'name'), + (r) => { + console.log(r); + return cur_frm.fields_dict.employees.grid.grid_rows[0].doc.employee = r.message.name; + }, () => { - cur_frm.fields_dict.employees.grid.grid_rows[0].doc.attendance = "Optional"; + return cur_frm.fields_dict.employees.grid.grid_rows[0].doc.attendance = "Optional"; }, () => frappe.click_button('Save'), - () => frappe.timeout(1), + () => frappe.timeout(2), () => frappe.click_button('Submit'), - () => frappe.timeout(1), + () => frappe.timeout(2), () => frappe.click_button('Yes'), () => frappe.timeout(1), () => {