Source code for odoo_xmlrpc_twisted.functions.get_user_profile_values

"""
Module get some values from 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_user_profile_values(user_id): """ Get some parameter from a user. The parameter are the profile values. """ result = 'false' custom_login = '' custom_email = '' custom_name = '' custom_title = '' custom_lang = '' language_details = '' custom_phone_number = '' custom_mobile_number = '' if user_id != '': # search for the user to get the values of the user res_user_id = models.execute_kw(db,uid, password, 'res.users', 'search_read', [[['id', '=', user_id],]]) # get the 'profile' values of the user if res_user_id: for key, value in list(res_user_id[0].items()): if key == "login": custom_login = value if key == "email": custom_email = value if key == "name": custom_name = value if key == "title": custom_title = value if key == "lang": custom_lang = value if key == "phone": custom_phone_number = value if key == "mobile": custom_mobile_number = value # get the details for the language of the user from the model "res.lang" language_details = models.execute_kw(db, uid, password, 'res.lang', 'search_read', [[['code', '=', custom_lang]]], {'fields': ['name', 'code']}) result = 'True' else: # reset also the "user_id" value to be on the safe side user_id = '' else: pass return(result, custom_login, custom_email, custom_name, custom_title, language_details, custom_phone_number, custom_mobile_number)