Source code for odoo_xmlrpc_twisted.functions.name_exist
"""Module checks if a user with that name already exists."""# 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]defname_exist(name):""" Function checks if a user with that name already exists in the odoo database in the table res.users. """result='False'ifname!='':# check if the name already existsnumber=models.execute_kw(db,uid,password,'res.users','search_count',[[['name','=',name],]])ifnumber>0:result='True'else:passreturn(result)