Source code for odoo_xmlrpc_twisted.support.support_change_password
"""Supporting program to test the module :func:`odoo_xmlrpc_twisted.functions.change_password`."""importsysimportos# Add functions directory to path for importing custom modulessys.path.append(os.path.join(os.path.dirname(__file__),'..','functions'))fromchange_passwordimportchange_passwordfromget_settings_odooimportget_settings_odoo# Call the function "get_settings_odoo" to get the parameters# for the logging of the model on the "odoo Webservice API"result=get_settings_odoo()db=result[0]uid=result[1]password=result[3]models=result[4]
[docs]defsupport_change_password(custom_email,custom_password):""" Function to test the module "change_password". As a prerequisite, it will be checked if the dedicated user is activated. If not, the user will be activated. Then the function 'change_password' will be called to test if a new dedicated user could be created. """ifcustom_email!='':# find the user for whom the password should be updatedres_users_id=models.execute_kw(db,uid,password,'res.users','search',[[['login','=',custom_email],['x_activate_complete','=',False],]])# if a user exist:# update of 'x_activate_complete' so that the user is active# and the login could be changedforxinres_users_id:id=xresult=models.execute_kw(db,uid,password,'res.users','write',[[id],{'x_activate_complete':True}])# call the function 'change_password' to see if it worksresult=change_password(custom_email,custom_password)return(result)