Source code for odoo_xmlrpc_twisted.functions.get_credentials

"""
Get the credentials of a user.
"""


# 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]
uid      = result[1]
password = result[3]
models   = result[4]

    
[docs] def get_credentials(login): """ Function get the user credentials from a dedicated user. The user must be activated ('x_activate_complete' = 'True'). """ result = 'false' user_id = '' name = '' email = '' partner_id = '' language = '' if login != '': # search for the user res_user_id = models.execute_kw(db,uid, password, 'res.users', 'search_read', [[['login', '=', login], ['x_activate_complete', '=', True],]]) # get the credentials of the user if res_user_id: for key, value in list(res_user_id[0].items()): if key == "id": user_id = value if key == "name": name = value if key == "email": email = value if key == "partner_id": partner_id = value[0] if key == "lang": language = value result = 'True' else: # reset also the "login" value to be on the safe side login = '' else: pass return(result, user_id, name, login, email, partner_id, language)