Source code for odoo_xmlrpc_twisted.support.support_create_resettoken
"""Supporting program to test the module :func:`odoo_xmlrpc_twisted.functions.create_resettoken`."""importsysimportos# Add functions directory to path for importing custom modulessys.path.append(os.path.join(os.path.dirname(__file__),'..','functions'))fromcreate_resettokenimportcreate_resettokenfromget_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_create_resettoken(custom_login):""" Function to test the module "create_resettoken". As a prerequisite, 'x_activate_complete' must be set to 'True'. Then the function 'create_resettoken' will be called to see if it works. Result is the reset_token. """ifcustom_login!='':# find user in the table 'res.users' with the login = custom_loginusers_id=models.execute_kw(db,uid,password,'res.users','search',[[['login','=',custom_login],['x_reset_complete','=',False],]])# update the user record with if neccesaryforu_idinusers_id:models.execute_kw(db,uid,password,'res.users','write',[[u_id],{'x_activate_complete':True,}])# call the function create_resettoken to see if it workscustom_x_reset_token=create_resettoken(custom_login)return(custom_x_reset_token)