Files
gzth/attendance_iot/models/attendance_iot_manager.py
T
2025-06-30 09:19:51 +08:00

44 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
from odoo import api, fields, models, tools, _
from datetime import datetime, time, timedelta
from odoo import api, fields, models, tools
from odoo.exceptions import UserError
import paho.mqtt.client as mqtt
import logging
_logger = logging.getLogger(__name__)
class AttendanceIotManager(models.Model):
_name = 'attendance.iot.manager'
_description = "考勤机管理"
attendance_iot_id = fields.Many2one('attendance.iot', string="设备号")
attendance_address = fields.Char(string="设备地址")
data_selection = fields.Selection([('mqtt', 'mqtt'), ('api', 'api')], default="mqtt", string="数据类型")
def action_attendance_iot_manager(self):
return {
"type": "ir.actions.act_window",
"name": "批量导入考勤机",
"res_model": "attendance.iot.manager.wizard",
"view_mode": "form",
"target": "new",
}
def employee_message(self):
domain = [('attendance_iot_id', '=', self.name)]
return {
'name': '员工列表',
'type': 'ir.actions.act_window',
'res_model': 'attendance.iot.user',
'view_mode': 'tree',
'domain': domain,
'target': 'current'
}