Attendance Request

Hello community,

In Attendance request Doctype, when we submit an attendance request by an workflow, the attendance for the respective request is marked and changed the status field from ‘Absent’ to ‘Present’. But I need additionally the working hours value . when I edit the code attendance_request.py it shows only the value of the field ‘working hours’ as 0.0. Remains no change.The following is the changes that I have made in the create_or_update_attendance function in attendance_request.py:

def create_or_update_attendance(self, date: str):
attendance_name = self.get_attendance_record(date)
status = self.get_attendance_status(date)

if attendance_name:
    # update existing attendance, change the status and working hours
    doc = frappe.get_doc("Attendance", attendance_name)
    old_status = doc.status

    if old_status != status:
        doc.db_set({"status": status, "attendance_request": self.name})

        if status != "Absent":
            doc.db_set("working_hours", 8.0)
        else:
            doc.db_set("working_hours", 0.0)

        text = _("changed the status from {0} to {1}  via Attendance Request").format(
            frappe.bold(old_status), frappe.bold(status)
        )
        doc.add_comment(comment_type="Info", text=text)

        frappe.msgprint(
            _("Updated status from {0} to {1} for date {2} in the attendance record {3}").format(
                frappe.bold(old_status),
                frappe.bold(status),
                frappe.bold(format_date(date)),
                get_link_to_form("Attendance", doc.name),
            ),
            title=_("Attendance Updated"),
        )
else:
    # submit a new attendance record
    doc = frappe.new_doc("Attendance")
    doc.employee = self.employee
    doc.attendance_date = date
    doc.company = self.company
    doc.attendance_request = self.name
    doc.status = status
    doc.working_hours = 8.0 if status != "Absent" else 0.0
    doc.insert(ignore_permissions=True)
    doc.submit()

return doc