Source code for odoo_xmlrpc_twisted.functions.test_odoo_connection

"""
Test the connection to Odoo Server.
"""


# call the function "get_settings_odoo" to get the parameters
# for the logging of the model on the "odoo Webservice API"
try:
    from .get_settings_odoo import get_settings_odoo
except ImportError:
    from get_settings_odoo import get_settings_odoo
result   = get_settings_odoo()

db              = result[0]
username        = result[2]
password        = result[3]
models          = result[4]
common_endpoint = result[5]


[docs] def test_odoo_connection(): """ Tests if the connection to the odoo system works. The function gives back the result of the testing. """ try: # used to refer to the common endpoint of the Odoo XML-RPC API common = common_endpoint # test if a connection to the Odoo Server works userid = common.authenticate(db, username, password, {}) # returns a userid if successful if userid != False: result = 'True' else: result = 'False' except: result = 'False' return(result)