phamos-eu / HR-Addon

HR Add-on for ERPNext
Other
24 stars 40 forks source link

Creating Work Days - canceled attendance is taken instead of current attendance #91

Closed ReachyBayern closed 1 month ago

ReachyBayern commented 3 months ago

If a leave application was canceled, changed and again executed as a new leave application record, the worng record will be found during creation of work days because in the sql statement the "docstatus" filter is missing. The solution should look like:

File: Root / opt / bench / erpnext / apps / hr_addon / hr_addon / hr_addon / api / utils.py

Function:

def get_employee_attendance(employee,atime):
    ''' select DATE('date time');'''
    employee = employee
    atime = atime

    #checkin_list = []
    attendance_list = frappe.db.sql(
        """
        SELECT  name,employee,status,attendance_date,shift FROM `tabAttendance` 
        WHERE employee='%s' AND DATE(attendance_date)= DATE('%s') AND docstatus < 2 ORDER BY attendance_date ASC
        """%(employee,atime), as_dict=1
    )
    #print(f'\n\n\n\n inside valid : {checkin_list} \n\n\n\n')
    return attendance_list
wojosc commented 3 months ago

@reggaetuna @beingeek

beingeek commented 3 months ago

checking

beingeek commented 1 month ago

resolved in version-14 and version-15 via following PR's

104 version-14

102 version-15