diff --git a/attendance_iot/controllers/kaoqin_test.py b/attendance_iot/controllers/kaoqin_test.py
index d2caba04d..9009cb25b 100644
--- a/attendance_iot/controllers/kaoqin_test.py
+++ b/attendance_iot/controllers/kaoqin_test.py
@@ -47,7 +47,6 @@ class BusController(Controller):
user_id = data.get('logs')[0].get('user_id')
employee_id = request.env(user=SUPERUSER_ID)["hr.employee"].search([('mobile_phone', '=', user_id)])
recog_time_str = data.get('logs')[0].get("recog_time")
- # checkin_time = datetime.strptime(recog_time_str, "%Y-%m-%d %H:%M:%S") + timedelta(hours=8)
checkin_time = datetime.strptime(recog_time_str, "%Y-%m-%d %H:%M:%S")
attendance_iot_id = request.env(user=SUPERUSER_ID)["attendance.iot"].search([('name', '=', data.get('sn'))])
if employee_id:
@@ -57,6 +56,7 @@ class BusController(Controller):
'source': 'iot', # 打卡来源
'attendance_iot_id': attendance_iot_id.id, # 打卡设备
})
+ request.env(user=SUPERUSER_ID)["hr.attendance.detail"].get_hr_attendance_time(employee_id.user_id.login)
return {"Result": 0, "Msg": "添加成功"}
@route('/api/v1/user/inf_photo', methods=['POST'], type='json', auth='none', csrf=False)
diff --git a/yuthon_hr_attendance/controllers/applet_attendance.py b/yuthon_hr_attendance/controllers/applet_attendance.py
index 009fe3764..0194d62b3 100644
--- a/yuthon_hr_attendance/controllers/applet_attendance.py
+++ b/yuthon_hr_attendance/controllers/applet_attendance.py
@@ -54,32 +54,33 @@ class AppletAttendance(Controller):
attendance_id = request.env(user=SUPERUSER_ID)["hr.attendance"].search([('employee_id', '=', employee_id.id), ('current_data', '=', current_date)])
check_in = attendance_id.check_in + timedelta(hours=8) if attendance_id.check_in else ''
check_out = attendance_id.check_out + timedelta(hours=8) if attendance_id.check_out else ''
-
- if not attendance_id.shift_id:
- year = attendance_id.current_data.year
- month = attendance_id.current_data.month
- day = attendance_id.current_data.day
- current_date = datetime.today()
- min_hour_from = attendance_id.employee_id.resource_id.calendar_id.attendance_ids[0].hour_from
- min_hour = int(min_hour_from)
- min_minute = int(min_hour_from * 10 % min_hour_from)
- will_datetime_start = current_date.replace(year=year, month=month, day=day, hour=min_hour,
- minute=min_minute)
- max_hour_to = attendance_id.employee_id.resource_id.calendar_id.attendance_ids[-1].hour_to
- max_hour = int(max_hour_to)
- max_minute = int(max_hour_to * 10 % max_hour_to)
- will_datetime_end = current_date.replace(year=year, month=month, day=day, hour=max_hour,
- minute=max_minute)
- start_time_str = will_datetime_start.strftime('%H:%M')
- end_time_str = will_datetime_end.strftime('%H:%M')
- else:
- check_in_start = attendance_id.shift_id.template_id.check_in_start
- check_out_end = attendance_id.shift_id.template_id.check_out_end
- start_minute = int((check_in_start - int(check_in_start)) * 60)
- end_minute = int((check_out_end - int(check_out_end)) * 60)
- start_time_str = f"{int(check_in_start):02d}-{start_minute:02d}"
- end_time_str = f"{int(check_out_end):02d}-{end_minute:02d}"
-
+ start_time_str = ''
+ end_time_str = ''
+ if attendance_id:
+ if not attendance_id.shift_id:
+ year = attendance_id.current_data.year
+ month = attendance_id.current_data.month
+ day = attendance_id.current_data.day
+ current_date = datetime.today()
+ min_hour_from = attendance_id.employee_id.resource_id.calendar_id.attendance_ids[0].hour_from
+ min_hour = int(min_hour_from)
+ min_minute = int(min_hour_from * 10 % min_hour_from)
+ will_datetime_start = current_date.replace(year=year, month=month, day=day, hour=min_hour,
+ minute=min_minute)
+ max_hour_to = attendance_id.employee_id.resource_id.calendar_id.attendance_ids[-1].hour_to
+ max_hour = int(max_hour_to)
+ max_minute = int(max_hour_to * 10 % max_hour_to)
+ will_datetime_end = current_date.replace(year=year, month=month, day=day, hour=max_hour,
+ minute=max_minute)
+ start_time_str = will_datetime_start.strftime('%H:%M')
+ end_time_str = will_datetime_end.strftime('%H:%M')
+ else:
+ check_in_start = attendance_id.shift_id.template_id.check_in_start
+ check_out_end = attendance_id.shift_id.template_id.check_out_end
+ start_minute = int((check_in_start - int(check_in_start)) * 60)
+ end_minute = int((check_out_end - int(check_out_end)) * 60)
+ start_time_str = f"{int(check_in_start):02d}-{start_minute:02d}"
+ end_time_str = f"{int(check_out_end):02d}-{end_minute:02d}"
is_early_card = attendance_id.is_early_card
is_late_card = attendance_id.is_late_card
check_in_status = '缺卡' if not check_in else ('迟到' if is_late_card else '')
diff --git a/yuthon_hr_attendance/views/hr_attendance_detail_wechat_views.xml b/yuthon_hr_attendance/views/hr_attendance_detail_wechat_views.xml
index ec0fe1684..8c0e0a9f7 100644
--- a/yuthon_hr_attendance/views/hr_attendance_detail_wechat_views.xml
+++ b/yuthon_hr_attendance/views/hr_attendance_detail_wechat_views.xml
@@ -31,9 +31,9 @@
hr.attendance.detail
-
+
+
+