Source code for odoo_xmlrpc_twisted.functions.email_exist

"""
Check if a user with that e-mail 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_odoo import get_settings_odoo
except ImportError:
    from get_settings_odoo import get_settings_odoo
settings = get_settings_odoo()
db       = settings[0]
uid      = settings[1]
password = settings[3]
models   = settings[4]


[docs] def email_exist(email): """ Functions tests if a user with that e-mail already exists in the odoo database. """ result = 'False' if email != '': number = models.execute_kw(db,uid, password, 'res.users', 'search_count', [[['email', '=', email], ]]) if number > 0: result = 'True' else: pass return(result)