Salary Structure Assignment - remove to_date (#14642)
* Salary Structure Assignment - remove to_date
* fix Salary Assignment - remove to_date
* Salary Slip - fix codacy remove sting based query, add end_date to condition
diff --git a/erpnext/hr/utils.py b/erpnext/hr/utils.py
index 7a861ac..6c31195 100644
--- a/erpnext/hr/utils.py
+++ b/erpnext/hr/utils.py
@@ -303,9 +303,7 @@
select * from `tabSalary Structure Assignment`
where employee=%(employee)s
and docstatus = 1
- and (
- (%(on_date)s between from_date and ifnull(to_date, '2199-12-31'))
- )""", {
+ and %(on_date)s >= from_date order by from_date desc limit 1""", {
'employee': employee,
'on_date': date,
}, as_dict=1)