diff --git a/attendance_iot/controllers/kaoqin_test.py b/attendance_iot/controllers/kaoqin_test.py index db22b86fa..bd7c061f7 100644 --- a/attendance_iot/controllers/kaoqin_test.py +++ b/attendance_iot/controllers/kaoqin_test.py @@ -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: diff --git a/onlyoffice_odoo/controllers/controllers.py b/onlyoffice_odoo/controllers/controllers.py index f03540cc7..87ecf246d 100644 --- a/onlyoffice_odoo/controllers/controllers.py +++ b/onlyoffice_odoo/controllers/controllers.py @@ -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, }, } diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index 7acf7f37e..d8f9ee1dd 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -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: diff --git a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py index e63daac1a..ead52a495 100644 --- a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py +++ b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py @@ -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: diff --git a/yuthon_will_task/models/inherit_room_booking.py b/yuthon_will_task/models/inherit_room_booking.py index d83497378..568670b55 100644 --- a/yuthon_will_task/models/inherit_room_booking.py +++ b/yuthon_will_task/models/inherit_room_booking.py @@ -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) # ⑦ 主持人