!12727 添加功能

Merge pull request !12727 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2026-08-25 09:14:07 +00:00
committed by Gitee
5 changed files with 39 additions and 12 deletions
+16 -7
View File
@@ -113,13 +113,22 @@ class BusController(Controller):
_logger.info(f'==========考勤机发送过来的用户和时间{user_id}={employee_id.name}=={recog_time}')
attendance_iot_id = request.env(user=SUPERUSER_ID)["attendance.iot"].search([('name', '=', data.get('sn'))])
if employee_id:
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}")
# 防重复:考勤机会重发旧日志,同一员工+同一打卡时间已存在则跳过
dup_count = request.env(user=SUPERUSER_ID)["hr.attendance.detail"].search_count([
('employee_id', '=', employee_id.id),
('checkin_time', '=', recog_time_adjusted),
('source', '=', 'iot'),
])
if dup_count:
_logger.info(f"重复打卡跳过:{user_id}={recog_time}")
else:
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"---考勤机名称-id:{attendance_iot_id.name}-{attendance_iot_id.id}-===okokokokokokokokokokok==----")
# 更新设备最后触发时间 & 写日志
if attendance_iot_id:
+12 -1
View File
@@ -143,6 +143,17 @@ class Onlyoffice_Connector(http.Controller):
is_mobile = bool(re.search(_mobile_regex, request.httprequest.headers.get("User-Agent"), re.IGNORECASE))
# 默认缩放:手机端/桌面端分别由系统参数 onlyoffice_connector.zoom_mobile / zoom_desktop 控制
# 取值:-2=页面宽度自适应 -1=整页适应 正整数=百分比(如100) 0或留空=编辑器默认(100%)
customization = {}
try:
zoom_param = 'onlyoffice_connector.zoom_mobile' if is_mobile else 'onlyoffice_connector.zoom_desktop'
zoom_val = request.env['ir.config_parameter'].get_param(zoom_param, '')
if zoom_val and zoom_val.lstrip('-').isdigit() and int(zoom_val) != 0:
customization['zoom'] = int(zoom_val)
except Exception:
pass
root_config = {
"width": "100%",
"height": "100%",
@@ -159,7 +170,7 @@ class Onlyoffice_Connector(http.Controller):
"mode": "edit" if can_write else "view",
"lang": request.env.user.lang,
"user": {"id": str(request.env.user.id), "name": request.env.user.name},
"customization": {},
"customization": customization,
},
}
+1 -1
View File
@@ -1288,7 +1288,7 @@ class HrAttendance(models.Model):
pass #todo 待过
def update_attendance(self, employee, current_date):
if self.shift_name == '外派':
if '外派' in self.mapped('shift_name'):
return
# 判断当天入职:
if employee.entry_date:
@@ -443,7 +443,14 @@ class HrAttendanceDetail(models.Model):
'is_expatriation': is_expatriation,
})
else:
attendance = self.env['hr.attendance'].create({
existing_att = self.env['hr.attendance'].search(
[('employee_id', '=', employee.id),
('current_data', '=', current_data)],
limit=1)
if existing_att:
attendance = existing_att
else:
attendance = self.env['hr.attendance'].create({
'employee_id': employee.id,
'shift_id': planning_slots.id,
'shift_name': planning_slots.display_name,
@@ -465,7 +472,7 @@ class HrAttendanceDetail(models.Model):
'is_week': False,
'absenteeism_card': absenteeism_card,
})
attendance.update_attendance(employee, current_data)
attendance[:1].update_attendance(employee, current_data)
else:
att_id = self.env['hr.attendance'].search([('employee_id', '=', employee.id), ('current_data', '=', current_data)])
if att_id:
@@ -55,7 +55,7 @@ class InheritRoomBooking(models.Model):
role_employees = self.env['hr.employee'].search([
'|',
('user_role_id', 'in', role_group_roles.ids),
('user_ids', 'in', role_group_roles.ids)
('user_role_ids', 'in', role_group_roles.ids)
])
employee_list.extend(role_employees.ids)
# ⑦ 主持人