Skip to content

Commit 9c00c18

Browse files
asmitahasemergify[bot]
authored andcommitted
fix: half day status change when attendance is created through attendance request
(cherry picked from commit 69c7b21)
1 parent 9805d83 commit 9c00c18

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

hrms/hr/doctype/attendance_request/attendance_request.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,15 @@ def create_or_update_attendance(self, date: str):
100100

101101
if old_status != status:
102102
doc.db_set({"status": status, "attendance_request": self.name})
103-
text = _("changed the status from {0} to {1} via Attendance Request").format(
104-
frappe.bold(old_status), frappe.bold(status)
105-
)
103+
if status == "Half Day":
104+
doc.db_set("half_day_status", "Absent")
105+
text = _(
106+
"Changed the status from {0} to {1} and Status for Other Half to {2} via Attendance Request"
107+
).format(frappe.bold(old_status), frappe.bold(status), frappe.bold("Absent"))
108+
else:
109+
text = _("Changed the status from {0} to {1} via Attendance Request").format(
110+
frappe.bold(old_status), frappe.bold(status)
111+
)
106112
doc.add_comment(comment_type="Info", text=text)
107113

108114
frappe.msgprint(
@@ -123,6 +129,7 @@ def create_or_update_attendance(self, date: str):
123129
doc.company = self.company
124130
doc.attendance_request = self.name
125131
doc.status = status
132+
doc.half_day_status = "Absent" if status == "Half Day" else None
126133
doc.insert(ignore_permissions=True)
127134
doc.submit()
128135

0 commit comments

Comments
 (0)