1
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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 '')
|
||||
|
||||
@@ -31,9 +31,9 @@
|
||||
<field name="model">hr.attendance.detail</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="hr attendance detail">
|
||||
<header>
|
||||
<button name="get_hr_attendance_time" type="object" string="手动计算" display="always"/>
|
||||
</header>
|
||||
<!-- <header>-->
|
||||
<!-- <button name="get_hr_attendance_time" type="object" string="手动计算" display="always"/>-->
|
||||
<!-- </header>-->
|
||||
<field name="employee_id"/>
|
||||
<field name="company_id" optional="hide"/>
|
||||
<field name="department_id"/>
|
||||
|
||||
Reference in New Issue
Block a user