fix: wrong company selected when marking attendance for all employees (#27685) (#27707)

* fix: wrong company selected when marking attendance for all employees

* fix: enable caching for repeated queries of the same employee


(cherry picked from commit b478e72cefbdffd3e906fdd1ef822becdead78d7)

Co-authored-by: Mohammed Yusuf Shaikh <49878143+mohammedyusufshaikh@users.noreply.github.com>
diff --git a/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.py b/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.py
index 7c751a4..1a1bcb2 100644
--- a/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.py
+++ b/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.py
@@ -55,8 +55,7 @@
 		else:
 			leave_type = None
 
-		if not company:
-			company = frappe.db.get_value("Employee", employee['employee'], "Company")
+		company = frappe.db.get_value("Employee", employee['employee'], "Company", cache=True)
 
 		attendance=frappe.get_doc(dict(
 			doctype='Attendance',
@@ -68,4 +67,4 @@
 			company=company
 		))
 		attendance.insert()
-		attendance.submit()
+		attendance.submit()
\ No newline at end of file