@@ -360,9 +360,25 @@ class HrAttendanceDetail(models.Model):
|
||||
is_early_card, is_late_card, is_abnormal, is_warning, absenteeism_card, is_no_card = self.state_judgment(employee, check_in_time, check_out_time, sch_check_in_time, sch_check_out_time, current_data, is_manual)
|
||||
is_expatriation = self.env['expatriation.approval'].search([('work_end', '=', True),('expatriates_ids', 'in', [employee.id]), ('is_effect', '=', False)])
|
||||
if not self._process_shift_days(current_data):
|
||||
if checkin_times:
|
||||
check_in_time = min(checkin_times) - timedelta(hours=8)
|
||||
check_out_time = max(checkin_times) - timedelta(hours=8)
|
||||
start_datetime = datetime.combine(current_data, datetime.min.time())
|
||||
end_datetime = datetime.combine(current_data, datetime.max.time())
|
||||
domain = [
|
||||
('employee_id', '=', employee.id),
|
||||
('checkin_time', '>=', start_datetime),
|
||||
('checkin_time', '<=', end_datetime)
|
||||
]
|
||||
attendance_records = self.search(domain)
|
||||
if attendance_records:
|
||||
checkin_time_list = [rec.checkin_time for rec in attendance_records if rec.checkin_time]
|
||||
if checkin_time_list:
|
||||
min_time = min(checkin_time_list)
|
||||
max_time = max(checkin_time_list)
|
||||
if min_time == max_time:
|
||||
check_in_time = min_time
|
||||
check_out_time = None
|
||||
else:
|
||||
check_in_time = min_time
|
||||
check_out_time = max_time
|
||||
|
||||
if attendance:
|
||||
attendance.write({
|
||||
|
||||
Reference in New Issue
Block a user