-
Notifications
You must be signed in to change notification settings - Fork 795
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Payroll): Option to use Email Template when send Salary Slip email
- Loading branch information
Showing
3 changed files
with
55 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ class TestSalarySlip(FrappeTestCase): | |
def setUp(self): | ||
setup_test() | ||
frappe.flags.pop("via_payroll_entry", None) | ||
create_ss_email_template() | ||
clear_cache() | ||
|
||
def tearDown(self): | ||
|
@@ -607,6 +608,22 @@ def test_email_salary_slip(self): | |
email_queue = frappe.db.a_row_exists("Email Queue") | ||
self.assertTrue(email_queue) | ||
|
||
@change_settings( | ||
"Payroll Settings", | ||
{"email_salary_slip_to_employee": 1, "email_template": "Salary Slip"} | ||
) | ||
def test_email_salary_slip_with_email_template(self): | ||
frappe.db.delete("Email Queue") | ||
|
||
emp_id = make_employee("[email protected]", company="_Test Company") | ||
ss = make_employee_salary_slip(emp_id, "Monthly", "Test Salary Slip Email") | ||
ss.company = "_Test Company" | ||
ss.save() | ||
ss.submit() | ||
|
||
email_queue = frappe.db.a_row_exists("Email Queue") | ||
self.assertTrue(email_queue) | ||
|
||
@if_lending_app_installed | ||
def test_loan_repayment_salary_slip(self): | ||
from lending.loan_management.doctype.loan.test_loan import ( | ||
|
@@ -2391,6 +2408,20 @@ def mark_attendance( | |
attendance.submit() | ||
|
||
|
||
def create_ss_email_template(): | ||
if not frappe.db.exists("Email Template", "Salary Slip"): | ||
ss_template = frappe.get_doc( | ||
{ | ||
"doctype": "Salary Slip", | ||
"name": "Delivery Notification", | ||
"response": "Test Salary Slip", | ||
"subject": "Test Subject", | ||
"owner": frappe.session.user, | ||
} | ||
) | ||
ss_template.insert() | ||
|
||
|
||
def clear_cache(): | ||
for key in [ | ||
HOLIDAYS_BETWEEN_DATES, | ||
|