添加功能

This commit is contained in:
zhou
2025-07-25 20:22:28 +08:00
parent ff637692fd
commit 22c067cc77
2 changed files with 15 additions and 12 deletions
+14 -11
View File
@@ -143,7 +143,7 @@ class HrAttendance(models.Model):
if employee.id not in [emp.id for emp in abnormal_employees]:
abnormal_employees.append(employee)
for emp in abnormal_employees:
url = f'https://oa.thtzjt.com/web#id={self.id}&cids=2&action={menu_id.action.id}&model=hr.attendance&view_type=list&menu_id={menu_id.id}'
url = f'https://oa.thtzjt.com/web?login={emp.user_id.login}&oauth_uid={emp.wecom_userid}#id={self.id}&cids=2&action={menu_id.action.id}&model={self._name}&view_type=form'
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='att', user_id=emp.wecom_userid,
title="打卡异常提醒", description="您本月有打卡异常",
url=url, btntxt="详细信息")
@@ -260,6 +260,7 @@ class HrAttendance(models.Model):
employee_id = self.employee_id.id
current_date = self.current_data
domain = [
("exception_type", "!=", "未打卡"),
('employee_id', '=', employee_id),
('checkin_time', '>=', fields.Datetime.to_string(datetime.combine(current_date, datetime.min.time()))),
('checkin_time', '<', fields.Datetime.to_string(datetime.combine(current_date, datetime.max.time())))
@@ -707,25 +708,27 @@ class HrAttendance(models.Model):
def card_in_comment(self, employee_id, planning_name):
data = f"您的班次是{planning_name},还有10分钟上班,记得打卡"
menu_id = self.sudo().env['ir.ui.menu'].search([('name', '=', '我的考勤')])
url = f'https://oa.thtzjt.com/web#id={self.id}&cids=2&action={menu_id.action.id}&model=hr.attendance&view_type=list&menu_id={menu_id.id}'
self.sudo().env["wecom.apps"].sync_send_message(category='att', user_id=employee_id.wecom_userid, message=data,
url = '#小程序://天投云/XttsPpKg3MEpY7h'
self.sudo().env["wecom.apps"].sync_send_message(category='att', user_id=employee_id.wecom_userid,
description=data,
title="打卡提醒",
url=url, btntxt="详细信息")
def card_out_comment(self, employee_id, planning_name):
data = f"您的班次是{planning_name},您该下班了,记得打卡"
menu_id = self.env['ir.ui.menu'].search([('name', '=', '我的考勤')])
url = f'https://oa.thtzjt.com/web#id={self.id}&cids=2&action={menu_id.action.id}&model=hr.attendance&view_type=list&menu_id={menu_id.id}'
self.sudo().env["wecom.apps"].sync_send_message(category='att', user_id=employee_id.wecom_userid, message=data,
url = '#小程序://天投云/XttsPpKg3MEpY7h'
self.sudo().env["wecom.apps"].sync_send_message(category='att', user_id=employee_id.wecom_userid,
description=data,
title="打卡提醒",
url=url, btntxt="详细信息")
def card_duty_remind(self, employee_id):
data = "今天您值班,记得打卡"
menu_id = self.env['ir.ui.menu'].search([('name', '=', '我的考勤')])
url = f'https://oa.thtzjt.com/web#id={self.id}&cids=2&action={menu_id.action.id}&model=hr.attendance&view_type=list&menu_id={menu_id.id}'
self.sudo().env["wecom.apps"].sync_send_message(category='att', user_id=employee_id.wecom_userid, message=data,
url = '#小程序://天投云/XttsPpKg3MEpY7h'
self.sudo().env["wecom.apps"].sync_send_message(category='att', user_id=employee_id.wecom_userid,
description=data,
title="打卡提醒",
url=url, btntxt="详细信息")
# @api.depends('employee_id')
@@ -11,7 +11,7 @@
<header>
<!-- <button name="compute_company_id" string="公司更新" type="object" class="btn btn-primary"/>-->
<!-- <button name="button_all" string="班次更新" type="object" class="btn btn-primary"/>-->
<!-- <button name="labor_update" string="考勤更新" type="object" class="btn btn-primary"/>-->
<button name="compute_attendance_ids" string="重新计算" type="object" class="btn btn-primary"/>
</header>
<field name="employee_id" class="list_current_data" options="{'no_create': True}"/>
<field name="current_data" optional="show" class="list_current_data"/>