[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) <yaso@odoo.com>
This commit is contained in:
lejeune quentin
2024-01-20 02:43:05 +00:00
parent cfea1ace7a
commit de1ff5b166
+1 -1
View File
@@ -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)