diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py index ba8cc0235d..53e6aa437e 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/salary_slip.py @@ -493,9 +493,9 @@ class SalarySlip(TransactionBase): # Calculate total exemption declaration exemption_amount = 0 if frappe.db.exists("Employee Tax Exemption Declaration", {"employee": self.employee, - "payroll_period": payroll_period.parent, "docstatus": 1}): + "payroll_period": payroll_period.name, "docstatus": 1}): exemption_amount = frappe.db.get_value("Employee Tax Exemption Declaration", - {"employee": self.employee, "payroll_period": "2018", "docstatus": 1}, #fix period + {"employee": self.employee, "payroll_period": payroll_period.name, "docstatus": 1}, #fix period "total_exemption_amount") annual_earning = annual_earning - exemption_amount diff --git a/erpnext/hr/utils.py b/erpnext/hr/utils.py index 315368dbab..20fe666d2b 100644 --- a/erpnext/hr/utils.py +++ b/erpnext/hr/utils.py @@ -236,7 +236,7 @@ def get_leave_period(from_date, to_date, company): return leave_period def get_payroll_period(from_date, to_date, company): - payroll_period = frappe.db.sql("""select pd.parent, pd.start_date, pd.end_date from + payroll_period = frappe.db.sql("""select pp.name, pd.start_date, pd.end_date from `tabPayroll Period Date` pd join `tabPayroll Period` pp on pd.parent=pp.name where pd.start_date<=%s and pd.end_date>= %s and pp.company=%s""", (from_date, to_date, company), as_dict=1)