From aa01cbd6bfaeed34d2f7ec0b9e63006738f433e6 Mon Sep 17 00:00:00 2001 From: pengyuthon Date: Mon, 9 Feb 2026 17:59:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=B7=E5=81=87=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wizard/export_date_wizard.py | 7 ++-- yuthon_wechat/models/wecom_apps.py | 32 ++++++++++--------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/yuthon_hr_attendance/wizard/export_date_wizard.py b/yuthon_hr_attendance/wizard/export_date_wizard.py index c4770e598..d7097b78d 100644 --- a/yuthon_hr_attendance/wizard/export_date_wizard.py +++ b/yuthon_hr_attendance/wizard/export_date_wizard.py @@ -93,16 +93,15 @@ class ExportDateWizard(models.TransientModel): domain = [ ('date_from', '>=', start_date), - ('date_from', '<', end_date), - ('is_filiing', '=', True) + ('date_from', '<', end_date) ] if active_ids: domain = [('id', 'in', active_ids)] + domain filtered_records = self.env['hr.leave'].search(domain) - + if not filtered_records: - raise UserError(f'在 {self.year} 年 {self.month} 月没有找到符合条件的归档请假记录(is_filiing=True)') + raise UserError(f'在 {self.year} 年 {self.month} 月没有找到符合条件的归档请假记录') filtered_ids = filtered_records.ids diff --git a/yuthon_wechat/models/wecom_apps.py b/yuthon_wechat/models/wecom_apps.py index 030533acc..d5ffe00e8 100644 --- a/yuthon_wechat/models/wecom_apps.py +++ b/yuthon_wechat/models/wecom_apps.py @@ -198,22 +198,24 @@ class WeComApps(models.Model): "btntxt": btntxt }, } - result_data = self.sync_function_api("message_send", "MESSAGE_SEND", data, category) - employee_id = self.sudo().env["res.users"].search([("login", "=", user_id)], limit=1).employee_ids - notice_type = 'attendance' if '记得打卡' in description else 'process' service_address = self.env['ir.config_parameter'].sudo().get_param('web.base.url') - self.env["attendance.message.log"].create({ - "employee_id": employee_id.id, - "content": description, - "notice_type": notice_type, - "service_address":service_address, - 'update_date': fields.Datetime.now(), - "message_url": url, - }) - _logger.info(f"------------------------接口收到响应返回值{result_data}-------------------------------") - if result_data.get("errcode", None) == 0: - return True, result_data - return False, result_data + _logger.info(f"企业微信接口请求地址{service_address}-------------------------------") + if '8057' not in service_address: + result_data = self.sync_function_api("message_send", "MESSAGE_SEND", data, category) + employee_id = self.sudo().env["res.users"].search([("login", "=", user_id)], limit=1).employee_ids + notice_type = 'attendance' if '记得打卡' in description else 'process' + self.env["attendance.message.log"].create({ + "employee_id": employee_id.id, + "content": description, + "notice_type": notice_type, + "service_address":service_address, + 'update_date': fields.Datetime.now(), + "message_url": url, + }) + _logger.info(f"------------------------接口收到响应返回值{result_data}-------------------------------") + if result_data.get("errcode", None) == 0: + return True, result_data + return False, result_data def sync_user_update(self, user_id=None, name=None, mobile=None, biz_mail=None, department=None): data = {}