Source code for odoo_xmlrpc_twisted.functions.change_password

"""
Change the password of the 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]
odoo_password = result[3]
models       = result[4]

 
[docs] def change_password(login, password): """ Function to change the password of a user. """ result = 'False' if login != '': try: # find the user which should be updated user_id = models.execute_kw(db, uid, odoo_password, 'res.users', 'search', [[ ['login', '=', login], ['x_activate_complete', '=', True], ]]) # update of the user for x in user_id: id = x models.execute_kw(db, uid, odoo_password, 'res.users', 'write', [[id], {'password': password}]) result = 'True' except: result = 'False' else: result = 'False' return(result)