考勤机日志
This commit is contained in:
@@ -9,9 +9,10 @@ _logger = logging.getLogger(__name__)
|
||||
class AttendanceIot(models.Model):
|
||||
_name = 'attendance.iot'
|
||||
_description = '考勤机设备'
|
||||
_rec_name = 'name'
|
||||
_rec_name = 'display_name'
|
||||
|
||||
name = fields.Char(string="设备号")
|
||||
display_name = fields.Char(string="名称", compute='_compute_display_name', store=True)
|
||||
attendance_address = fields.Char(string="设备地址")
|
||||
broker = fields.Char(string='服务器地址/ip')
|
||||
port = fields.Char(string='端口号')
|
||||
@@ -23,6 +24,18 @@ class AttendanceIot(models.Model):
|
||||
is_connected = fields.Boolean(string="连接状态", default=False)
|
||||
last_update_time = fields.Datetime(string="最后更新时间")
|
||||
|
||||
@api.depends('company_id', 'attendance_address', 'name')
|
||||
def _compute_display_name(self):
|
||||
for r in self:
|
||||
parts = []
|
||||
if r.company_id:
|
||||
parts.append(r.company_id.name)
|
||||
if r.attendance_address:
|
||||
parts.append(r.attendance_address)
|
||||
if r.name:
|
||||
parts.append(r.name)
|
||||
r.display_name = ' - '.join(parts) if parts else r.name or ''
|
||||
|
||||
def action_init_device(self):
|
||||
'''
|
||||
初始化设备数据
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
<header>
|
||||
<button name="action_init_device" string="下发全部员工" type="object"/>
|
||||
</header>
|
||||
<field name="name"/>
|
||||
<field name="display_name" string="设备名称"/>
|
||||
<field name="name" column_invisible="1"/>
|
||||
<field name="attendance_address"/>
|
||||
<field name="create_date" string="创建日期"/>
|
||||
<field name="company_id" column_invisible="1"/>
|
||||
@@ -38,6 +39,7 @@
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="display_name" string="设备名称"/>
|
||||
<field name="name"/>
|
||||
<field name="attendance_address"/>
|
||||
<field name="company_id"/>
|
||||
|
||||
Reference in New Issue
Block a user