考勤机
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
'views/attendance_iot_user_views.xml',
|
||||
'views/attendance_iot_manager_views.xml',
|
||||
'views/attendance_iot_views.xml',
|
||||
'views/attendance_iot_log_views.xml',
|
||||
# 'views/inherit_hr_employee_views.xml',
|
||||
'wizard/attendance_iot_manager_wizard_views.xml',
|
||||
'views/iot_message.xml'
|
||||
|
||||
@@ -4,3 +4,4 @@ from . import attendance_iot
|
||||
from . import attendance_iot_datas
|
||||
from . import attendance_iot_manager
|
||||
from . import iot_message
|
||||
from . import attendance_iot_log
|
||||
|
||||
@@ -20,6 +20,7 @@ class AttendanceIot(models.Model):
|
||||
company_id = fields.Many2one('res.company', string="公司")
|
||||
remake = fields.Text(string='备注')
|
||||
employee_ids = fields.Many2many('hr.employee', string="员工")
|
||||
is_connected = fields.Boolean(string="连接状态", default=False)
|
||||
|
||||
def action_init_device(self):
|
||||
'''
|
||||
@@ -102,3 +103,17 @@ class AttendanceIot(models.Model):
|
||||
'value': 'off'
|
||||
}, ensure_ascii=False)
|
||||
}])
|
||||
|
||||
def action_view_logs(self):
|
||||
"""查看该设备的日志"""
|
||||
self.ensure_one()
|
||||
return {
|
||||
'name': '考勤机日志',
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'attendance.iot.log',
|
||||
'view_mode': 'tree,form',
|
||||
'domain': [('attendance_iot_id', '=', self.id)],
|
||||
'context': {'default_attendance_iot_id': self.id},
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class AttendanceIotLog(models.Model):
|
||||
_name = 'attendance.iot.log'
|
||||
_description = '考勤机日志'
|
||||
_order = 'create_date desc'
|
||||
|
||||
attendance_iot_id = fields.Many2one('attendance.iot', string="考勤机设备", required=True, ondelete='cascade')
|
||||
content = fields.Text(string="内容")
|
||||
@@ -5,4 +5,5 @@ access_attendance_iot_manager_wizard,attendance.iot.manager.wizard,model_attenda
|
||||
access_attendance_iot_datas,attendance.iot.datas,model_attendance_iot_datas,base.group_user,1,1,1,1
|
||||
access_attendance_iot_user,attendance.iot.user,model_attendance_iot_user,base.group_user,1,1,1,1
|
||||
access_iot_message,iot.message.user,model_iot_message,base.group_user,1,1,1,1
|
||||
access_attendance_iot_import_user_wizard,access.attendance.iot.import.user.wizard,model_attendance_iot_import_user_wizard,base.group_user,1,1,1,1
|
||||
access_attendance_iot_import_user_wizard,access.attendance.iot.import.user.wizard,model_attendance_iot_import_user_wizard,base.group_user,1,1,1,1
|
||||
access_attendance_iot_log,attendance.iot.log,model_attendance_iot_log,base.group_user,1,1,1,1
|
||||
|
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<!-- 考勤机日志 tree 视图 -->
|
||||
<record id="attendance_iot_log_tree" model="ir.ui.view">
|
||||
<field name="name">attendance.iot.log.tree</field>
|
||||
<field name="model">attendance.iot.log</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="attendance_iot_id"/>
|
||||
<field name="create_date" string="创建日期"/>
|
||||
<field name="content"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- 考勤机日志 form 视图 -->
|
||||
<record id="attendance_iot_log_form" model="ir.ui.view">
|
||||
<field name="name">attendance.iot.log.form</field>
|
||||
<field name="model">attendance.iot.log</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="attendance_iot_id"/>
|
||||
<field name="create_date" string="创建日期"/>
|
||||
<field name="content"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- 考勤机日志 action -->
|
||||
<record id="attendance_iot_log_action" model="ir.actions.act_window">
|
||||
<field name="name">考勤机日志</field>
|
||||
<field name="res_model">attendance.iot.log</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -16,7 +16,9 @@
|
||||
<field name="company_id"/>
|
||||
<field name="number"/>
|
||||
<field name="remake"/>
|
||||
<field name="is_connected"/>
|
||||
<button name="open_record" type="object" string="详情" class="btn btn-blue"/>
|
||||
<button name="action_view_logs" type="object" string="日志" class="btn btn-blue"/>
|
||||
<button name="action_send_sync_sigle" type="object" string="同步数据" class="btn btn-blue"/>
|
||||
<button name="action_send_open_door_sigle" type="object" string="开门" class="btn btn-blue"/>
|
||||
<button name="action_send_close_door_sigle" type="object" string="关门" class="btn btn-blue"/>
|
||||
|
||||
Reference in New Issue
Block a user