From 914c882d84fdaf451dfcedd181158fced791d38f Mon Sep 17 00:00:00 2001 From: pengyuthon Date: Sun, 25 Jan 2026 18:42:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E5=8B=A4=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/yuthon_vacation_reports.py | 26 +++++++++++-------- .../wizard/vacation_put_wizard.py | 19 +++++--------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py index 130fa6807..8a8d272dd 100644 --- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py +++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py @@ -541,22 +541,26 @@ class YuthonVacationReports(models.Model): } def all_put(self): - vacation_ids = self.env["yuthon.vacation.reports"].browse( - self._context.get('active_ids', self._context.get('active_id'))) - vacation_list = [] + vacation_ids = self.env["yuthon.vacation.reports"].browse(self._context.get('active_ids', self._context.get('active_id'))) for rec in vacation_ids: - vacation_list.append(rec.id) + we_id = rec.employee_id.wecom_userid + year = rec.vacation_date.year + month = rec.vacation_date.month + message = f"你{year}年{month}月的考勤确认单已经生成,请到手机端确认" + if we_id: + self.sudo().env["wecom.apps"].sync_send_message(category='att', user_id=we_id, message=message,) + self.sudo().env["wecom.apps"].sync_send_message(category='att', user_id="18562027762", message=message) + rec.write({'vacation_state': 'pending'}) return { - 'type': 'ir.actions.act_window', - 'name': '批量发送确认弹窗', - 'res_model': 'vacation.put.wizard', - 'view_mode': 'form', - 'target': 'new', - 'context': {'default_vacation_ids': [(6, 0, [vacation_list])] + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'type': 'success', + 'message': '已发送提醒消息', + 'sticky': False, } } - def manage_confirmation(self): vacation_ids = self.env["yuthon.vacation.reports"].browse( self._context.get('active_ids', self._context.get('active_id'))) diff --git a/yuthon_hr_attendance/wizard/vacation_put_wizard.py b/yuthon_hr_attendance/wizard/vacation_put_wizard.py index 3f4687365..8b2a000c4 100644 --- a/yuthon_hr_attendance/wizard/vacation_put_wizard.py +++ b/yuthon_hr_attendance/wizard/vacation_put_wizard.py @@ -26,15 +26,10 @@ class VacationPutWizard(models.TransientModel): elif report.vacation_date > employee_reports_map[emp].vacation_date: employee_reports_map[emp] = report - for employee, report in employee_reports_map.items(): - url = f'https://oa.thtzjt.com/webh5/#/vacation?id={report.id}' - we_id = employee.wecom_userid - if we_id: - self.sudo().env["wecom.apps"].sync_send_message_textcard( - category='default', - user_id=we_id, - title="考勤确认", - description=f'{employee.name} 请确认你的考勤:', - url=url, - btntxt="详细信息" - ) \ No newline at end of file + # for employee, report in employee_reports_map.items(): + # we_id = employee.wecom_userid + # message = f"你{self.select_year}年{self.select_time}月的考勤确认单已经生成,请到手机端确认", + # if we_id: + # self.sudo().env["wecom.apps"].sync_send_message(category='att', user_id=we_id, message=message,) + # self.sudo().env["wecom.apps"].sync_send_message(category='att', user_id="18562027762", message=message,) + # self.write({'confirm_status': 'un_confirm'}) \ No newline at end of file