From de1ff5b166cd2ddf1ee2962655465b6a15109c04 Mon Sep 17 00:00:00 2001 From: lejeune quentin Date: Fri, 19 Jan 2024 10:16:09 +0100 Subject: [PATCH] [FIX] hw_drivers: Fix default value for iot_client on boot If an IoT doesn't have a DB recorded, the IoT client can't have an url. So the Websocket can't parse a empty string and return a traceback. With this commit we check if there are a DB else iot_client is None closes odoo/odoo#150089 Signed-off-by: Yaroslav Soroko (yaso) --- addons/hw_drivers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hw_drivers/main.py b/addons/hw_drivers/main.py index 8f7b005797c..9987824d52f 100644 --- a/addons/hw_drivers/main.py +++ b/addons/hw_drivers/main.py @@ -96,7 +96,7 @@ class Manager(Thread): _logger.warning("An error happened when trying to get the HTTPS certificate: %s", certificate_details) - iot_client = WebsocketClient(helpers.get_odoo_server_url()) + iot_client = helpers.get_odoo_server_url() and WebsocketClient(helpers.get_odoo_server_url()) # We first add the IoT Box to the connected DB because IoT handlers cannot be downloaded if # the identifier of the Box is not found in the DB. So add the Box to the DB. self.send_alldevices(iot_client)