考勤机后台按钮

This commit is contained in:
李鹏宇
2026-07-03 09:36:17 +08:00
parent d08f13cc39
commit df5bb4bf54
5 changed files with 38 additions and 16 deletions
+6
View File
@@ -26,4 +26,10 @@
'installable': True,
'application': True,
'license': 'LGPL-3',
'assets': {
'web.assets_backend': [
'attendance_iot/static/src/js/attendance_iot_button.js',
'attendance_iot/static/src/xml/attendance_iot_button.xml',
],
},
}
@@ -0,0 +1,20 @@
/** @odoo-module */
import { ListController } from "@web/views/list/list_controller";
import { registry } from '@web/core/registry';
import { listView } from '@web/views/list/list_view';
export class CustomAttendanceIotController extends ListController {
setup() {
super.setup();
}
openBackend() {
window.open('http://gzsthtz.com.cn:18083/#/clients', '_blank');
}
}
registry.category("views").add("custom_attendance_iot_button", {
...listView,
Controller: CustomAttendanceIotController,
buttonTemplate: "attendance_iot_module.ListView.Buttons",
});
@@ -0,0 +1,9 @@
<templates>
<t t-name="attendance_iot_module.ListView.Buttons" t-inherit="web.ListView.Buttons">
<xpath expr="//div[hasclass('o_list_buttons')]" position="after">
<button type="button" class="btn btn-primary" style="margin-left: 10px;" t-on-click="openBackend">
后台
</button>
</xpath>
</t>
</templates>
@@ -4,7 +4,7 @@
<field name="name">考勤机设备管理</field>
<field name="model">attendance.iot</field>
<field name="arch" type="xml">
<tree editable="bottom">
<tree editable="bottom" js_class="custom_attendance_iot_button">
<header>
<button name="action_init_device" string="下发全部员工" type="object"/>
</header>
@@ -1434,12 +1434,7 @@ class YuthonVacationReports(models.Model):
year = self.vacation_date.year
month = self.vacation_date.month
data = f"你{year}年{month}月的考勤确认单已经生成,请确认"
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='att_ok', user_id=we_id,
title="考勤确认单", description=data, url=url,
btntxt="详细信息")
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='att_ok', user_id="18562027762",
title="考勤确认单", description=data, url=url,
btntxt="详细信息")
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='att_ok', user_id=we_id, title="考勤确认单", description=data, url=url, btntxt="详细信息")
self.write({'vacation_state': 'pending'})
return {
'type': 'ir.actions.client',
@@ -1478,14 +1473,7 @@ class YuthonVacationReports(models.Model):
data = f"你{year}年{month}月的考勤确认单已经生成,请确认"
# 发送给员工
record.env["wecom.apps"].sync_send_message_textcard(
category='att_ok',
user_id=we_id,
title="考勤确认单",
description=data,
url=url,
btntxt="详细信息"
)
record.env["wecom.apps"].sync_send_message_textcard(category='att_ok', user_id=we_id,title="考勤确认单", description=data, url=url, btntxt="详细信息")
return
@@ -1558,7 +1546,6 @@ class YuthonVacationReports(models.Model):
url = f'https://phone.thtzjt.com/phone/Notarize/{rec.id}/{rec.employee_id.user_id.id}'
data = f"你{year}年{month}月的考勤确认单已经生成,请确认"
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='att_ok', user_id=we_id, title="考勤确认单", description=data, url=url, btntxt="详细信息")
# self.sudo().env["wecom.apps"].sync_send_message_textcard(category='att_ok', user_id="18562027762", title="考勤确认单", description=data, url=url, btntxt="详细信息")
rec.write({'vacation_state': 'pending'})
return {
'type': 'ir.actions.client',