Source code for odoo_xmlrpc_twisted.functions.get_language
"""Get the language 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_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_language(partner_id):""" Function gets the language of a user from odoo table 'res_partner'. """target_language='en_US'# default valueifpartner_id!='':lang_data=models.execute_kw(db,uid,password,'res.partner','search_read',[[['id','=',partner_id]]],{'fields':['lang']})# if the array is not empty# get the value for 'lang'iflang_data:forkey,valueinlist(lang_data[0].items()):ifkey=="lang":target_language=valuereturn(target_language)