考勤优化

This commit is contained in:
pengyuthon
2026-03-16 17:27:27 +08:00
parent f8b62f29c0
commit bb69e7c086
2 changed files with 9 additions and 8 deletions
+3 -2
View File
@@ -67,14 +67,15 @@ class BusController(Controller):
employee_id = request.env(user=SUPERUSER_ID)["hr.employee"].search([('mobile_phone', '=', user_id)])
attendance_iot_id = request.env(user=SUPERUSER_ID)["attendance.iot"].search([('name', '=', data.get('sn'))])
if employee_id:
request.env(user=SUPERUSER_ID)["hr.attendance.detail"].create({
details = request.env(user=SUPERUSER_ID)["hr.attendance.detail"].create({
'employee_id': employee_id.id, # 员工
'checkin_time': recog_time_adjusted,
'source': 'iot', # 打卡来源
'attendance_iot_id': attendance_iot_id.id, # 打卡设备
})
_logger.info(f"考勤机创建的数据:{details}")
_logger.info(f"考勤机自定义编码:{user_id}: {employee_id.name}打卡--{fields.Datetime.now()}")
# _logger.info(f"考勤机自定义编码{user_id}: {employee_id.name}打卡--{fields.Datetime.now()}")
return {"Result": 0, "Msg": "添加成功"}
@route('/api/v1/user/inf_photo', methods=['POST'], type='json', auth='none', csrf=False)
+6 -6
View File
@@ -368,12 +368,12 @@ class HrAttendance(models.Model):
description='考勤异常请尽快处理',
exception_alerts = True,
url=url, btntxt="查看详情")
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='att',
user_id='18562027762',
title='【考勤异常提醒】',
exception_alerts=True,
description='考勤异常请尽快处理',
url=url, btntxt="查看详情")
# self.sudo().env["wecom.apps"].sync_send_message_textcard(category='att',
# user_id='18562027762',
# title='【考勤异常提醒】',
# exception_alerts=True,
# description='考勤异常请尽快处理',
# url=url, btntxt="查看详情")
def missing_card_judgment(self):
today = fields.Date.today()