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_odooimportget_settings_odooexceptImportError:fromget_settings_odooimportget_settings_odooresult=get_settings_odoo()db=result[0]uid=result[1]password=result[3]models=result[4]
[docs]defget_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=''ifuser_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 ifres_user_id:forkey,valueinlist(res_user_id[0].items()):ifkey=="login":custom_login=valueifkey=="email":custom_email=valueifkey=="name":custom_name=valueifkey=="title":custom_title=valueifkey=="lang":custom_lang=valueifkey=="phone":custom_phone_number=valueifkey=="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 sideuser_id=''else:passreturn(result,custom_login,custom_email,custom_name,custom_title,language_details,custom_phone_number,custom_mobile_number)