diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py index 1d657dc0b86..f83d1448ec4 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/salary_slip.py @@ -64,8 +64,8 @@ class SalarySlip(TransactionBase): if self.salary_slip_based_on_timesheet and not self.get('timesheets'): self.set("timesheets", []) - timesheets = frappe.db.sql(""" select * from `tabTimesheet` where employee = %(employee)s and (status = 'Submitted' or - status = 'Billed')""", {'employee': self.employee}, as_dict=1) + timesheets = frappe.db.sql(""" select * from `tabTimesheet` where employee = %(employee)s and start_date BETWEEN %(start_date)s AND %(end_date)s and (status = 'Submitted' or + status = 'Billed')""", {'employee': self.employee, 'start_date': self.start_date, 'end_date': self.end_date}, as_dict=1) for data in timesheets: self.append('timesheets', {