From 83ec83539bc54ad9fd7029b1fa04d03abfc6119f Mon Sep 17 00:00:00 2001 From: pengyuthon Date: Wed, 19 Aug 2026 21:33:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E8=80=83=E5=8B=A4=E6=89=93=E5=8D=A1?= =?UTF-8?q?=E5=8E=BB=E9=87=8D=E9=98=B2=E9=87=8D=E5=A4=8D=E8=AE=B0=E5=BD=95?= =?UTF-8?q?/=E9=98=B2500=E5=B4=A9=E6=BA=83=20+=20OnlyOffice=20=E6=89=8B?= =?UTF-8?q?=E6=9C=BA=E7=AB=AF=E9=BB=98=E8=AE=A4=E7=BC=A9=E6=94=BE=E5=8F=AF?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- attendance_iot/controllers/kaoqin_test.py | 23 +++++++++++++------ onlyoffice_odoo/controllers/controllers.py | 13 ++++++++++- yuthon_hr_attendance/models/hr_attendance.py | 2 +- .../models/hr_attendance_detail_wechat.py | 11 +++++++-- 4 files changed, 38 insertions(+), 11 deletions(-) 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 680278b3c..abe4fa854 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -1279,7 +1279,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 37b1a4866..3c57d9690 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: From dc212655928c52b641fc329c54ddc2b2b60acc25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Tue, 25 Aug 2026 17:12:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_will_task/models/inherit_room_booking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) # ⑦ 主持人