fix the salary slip test cases

This commit is contained in:
Manas Solanki 2018-06-11 19:27:46 +05:30
parent 157815ff0c
commit f226b50d6d
2 changed files with 6 additions and 3 deletions

View File

@ -447,7 +447,7 @@ class SalarySlip(TransactionBase):
else:
self.set_status()
self.update_status(self.name)
if(frappe.db.get_single_value("HR Settings", "email_salary_slip_to_employee")) and not frappe.flags.via_payroll_entry:
if (frappe.db.get_single_value("HR Settings", "email_salary_slip_to_employee")) and not frappe.flags.via_payroll_entry:
self.email_salary_slip()
def on_cancel(self):
@ -466,7 +466,10 @@ class SalarySlip(TransactionBase):
"reference_doctype": self.doctype,
"reference_name": self.name
}
enqueue(method=frappe.sendmail, queue='short', timeout=300, async=True, **email_args)
if not frappe.flags.in_test:
enqueue(method=frappe.sendmail, queue='short', timeout=300, async=True, **email_args)
else:
frappe.sendmail(**email_args)
else:
msgprint(_("{0}: Employee email not found, hence email not sent").format(self.employee_name))

View File

@ -279,7 +279,7 @@ def make_salary_structure(sal_struct, payroll_frequency, employee):
"payroll_frequency": payroll_frequency,
"payment_account": get_random("Account")
}).insert()
create_salary_structure_assignment(employee, salary_structure)
create_salary_structure_assignment(employee, salary_structure.name)
elif not frappe.db.get_value("Salary Structure Assignment",{'salary_structure':sal_struct, 'employee':employee},'name'):
create_salary_structure_assignment(employee, sal_struct)