Skip to content
Snippets Groups Projects
Commit 173cfd89 authored by lejeune quentin's avatar lejeune quentin
Browse files

[FIX] hw_posbox_homepage: Fix to rename IoT Box


We must be able to change the hostname of IoT Box
even if we do not pass him a token.

So we give a default value to 'url' and 'token'

closes odoo/odoo#36428

Signed-off-by: default avatarQuentin Lejeune (qle) <qle@odoo.com>
parent ba05c66e
Branches
Tags
No related merge requests found
......@@ -226,14 +226,18 @@ class IoTboxHomepage(web.Home):
@http.route('/server_connect', type='http', auth='none', cors='*', csrf=False)
def connect_to_server(self, token, iotname):
credential = token.split('|')
url = credential[0]
token = credential[1]
if len(credential) > 2:
# IoT Box send token with db_uuid and enterprise_code only since V13
db_uuid = credential[2]
enterprise_code = credential[3]
helpers.add_credential(db_uuid, enterprise_code)
if token:
credential = token.split('|')
url = credential[0]
token = credential[1]
if len(credential) > 2:
# IoT Box send token with db_uuid and enterprise_code only since V13
db_uuid = credential[2]
enterprise_code = credential[3]
helpers.add_credential(db_uuid, enterprise_code)
else:
url = helpers.get_odoo_server_url()
token = helpers.get_token()
reboot = 'reboot'
subprocess.check_call([get_resource_path('point_of_sale', 'tools/posbox/configuration/connect_to_server.sh'), url, iotname, token, reboot])
return 'http://' + helpers.get_ip() + ':8069'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment