Added test cased
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py
index bf686d7..39adedd 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.py
@@ -211,10 +211,9 @@
def email_salary_slip(self):
receiver = frappe.db.get_value("Employee", self.employee, "company_email") or \
frappe.db.get_value("Employee", self.employee, "personal_email")
-
if receiver:
subj = 'Salary Slip - ' + cstr(self.month) +'/'+cstr(self.fiscal_year)
frappe.sendmail([receiver], subject=subj, message = _("Please see attachment"),
- attachments=[frappe.attach_print(self.doctype, self.name, file_name=self.name)])
+ attachments=[frappe.attach_print(self.doctype, self.name, file_name=self.name)], bulk=True)
else:
msgprint(_("{0}: Employee email not found, hence email not sent").format(self.employee_name))
diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.py b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
index 2383aff..106b8a2 100644
--- a/erpnext/hr/doctype/salary_slip/test_salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
@@ -96,6 +96,19 @@
frappe.set_user("test_employee@example.com")
self.assertTrue(salary_slip_test_employee.has_permission("read"))
+
+ def test_email_salary_slip(self):
+ frappe.db.sql("delete from `tabBulk Email`")
+
+ hr_settings = frappe.get_doc("HR Settings", "HR Settings")
+ hr_settings.email_salary_slip_to_employee = 1
+ hr_settings.save()
+
+ self.make_employee("test_employee@example.com")
+ self.make_employee_salary_slip("test_employee@example.com")
+ bulk_mails = frappe.db.sql("""select name from `tabBulk Email`""")
+ self.assertTrue(bulk_mails)
+
def make_employee(self, user):
if not frappe.db.get_value("User", user):
@@ -118,6 +131,7 @@
"date_of_joining": "2013-01-01",
"department": "_Test Department 1",
"gender": "Female",
+ "company_email": user,
"status": "Active"
}).insert()