开门,关门功能
This commit is contained in:
@@ -77,3 +77,27 @@ class AttendanceIot(models.Model):
|
||||
'cmd': 'uploadFaceInfo'
|
||||
}, ensure_ascii=False)
|
||||
}])
|
||||
|
||||
# 发送开门信号
|
||||
def action_send_open_door_sigle(self):
|
||||
for record in self:
|
||||
self.env['iot.message'].create([{
|
||||
'name': '开门',
|
||||
'topic': f'iot/device/{record.name}',
|
||||
'device_sn': record.name,
|
||||
'message_data': json.dumps({
|
||||
'cmd': 'setDoor',
|
||||
'value': 'on'
|
||||
}, ensure_ascii=False)
|
||||
}])
|
||||
def action_send_close_door_sigle(self):
|
||||
for record in self:
|
||||
self.env['iot.message'].create([{
|
||||
'name': '开门',
|
||||
'topic': f'iot/device/{record.name}',
|
||||
'device_sn': record.name,
|
||||
'message_data': json.dumps({
|
||||
'cmd': 'setDoor',
|
||||
'value': 'off'
|
||||
}, ensure_ascii=False)
|
||||
}])
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
<field name="remake"/>
|
||||
<button name="open_record" type="object" string="详情" class="btn-primary"/>
|
||||
<button name="action_send_sync_sigle" type="object" string="同步数据" class="btn-primary"/>
|
||||
<button name="action_send_open_door_sigle" type="object" string="开门" class="btn-primary"/>
|
||||
<button name="action_send_close_door_sigle" type="object" string="关门" class="btn-primary"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user