Source code for odoo_xmlrpc_twisted.support.support_create_activatetoken
"""Supporting program to test the module :func:`odoo_xmlrpc_twisted.functions.create_activatetoken`."""importsysimportos# Add functions directory to path for importing custom modulessys.path.append(os.path.join(os.path.dirname(__file__),'..','functions'))fromcreate_activatetokenimportcreate_activatetokenfromget_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_activatetoken(custom_login):""" Function to test the module "create_activatetoken". As a prerequisite, 'x_activate_complete' must be set to 'False'. Then the function 'create_activatetoken' will be called to see if it works. Result is the activate_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_activate_complete','=',True],]])# update the user record with "x_activate_complete: False" if neccesaryforu_idinusers_id:models.execute_kw(db,uid,password,'res.users','write',[[u_id],{'x_activate_complete':False,}])# call the function create_activatetoken to see if it workscustom_x_activate_token=create_activatetoken(custom_login)return(custom_x_activate_token)