Source code for odoo_xmlrpc_twisted.support.support_create_resettoken

"""
Supporting program to test the module :func:`odoo_xmlrpc_twisted.functions.create_resettoken`.
"""


import sys
import os

# Add functions directory to path for importing custom modules
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'functions'))
from create_resettoken import create_resettoken
from get_settings_odoo import get_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] def support_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. """ if custom_login != '': # find user in the table 'res.users' with the login = custom_login users_id = models.execute_kw(db, uid, password, 'res.users', 'search', [[['login', '=', custom_login], ['x_reset_complete', '=', False],]]) # update the user record with if neccesary for u_id in users_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 works custom_x_reset_token = create_resettoken(custom_login) return(custom_x_reset_token)