[FIX] hw_drivers: Error on distant_display refresh

Trying to call display_refresh or update_url when no screen was
connected to the IoT Box and the default distant_display was created
resulted in an error.

closes odoo/odoo#53975

X-original-commit: 77768b93bc64d47abdbd4abd48c386acb293815e
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
This commit is contained in:
Antoine Prieels
2020-07-02 11:52:36 +00:00
parent 2cb73e920b
commit 2761a2a127
@@ -53,9 +53,9 @@ class DisplayDriver(Driver):
return len(displays) and iot_devices[displays[0]]
def action(self, data):
if data.get('action') == "update_url":
if data.get('action') == "update_url" and self.device_identifier != 'distant_display':
self.update_url(data.get('url'))
elif data.get('action') == "display_refresh":
elif data.get('action') == "display_refresh" and self.device_identifier != 'distant_display':
self.call_xdotools('F5')
elif data.get('action') == "take_control":
self.take_control(self.data['owner'], data.get('html'))
@@ -141,7 +141,7 @@ class DisplayController(http.Controller):
@http.route('/hw_proxy/display_refresh', type='json', auth='none', cors='*')
def display_refresh(self):
display = DisplayDriver.get_default_display()
if display:
if display and display.device_identifier != 'distant_display':
return display.call_xdotools('F5')
@http.route('/hw_proxy/customer_facing_display', type='json', auth='none', cors='*')