Source code for odoo_xmlrpc_twisted.support.support_check_user_login

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


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 check_user_login import check_user_login
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_check_user_login(custom_email, custom_password): """ Function to test the module "check_user_login". As a prerequisite, it will be checked if the dedicated user is activated. If not, the user will be activated. Then the function 'check_user_login' will be called to test if a new dedicated user could be created. """ if custom_email != '': # find the user for whom the password should be updated res_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 changed for x in res_users_id: id = x result = models.execute_kw(db, uid, password, 'res.users', 'write', [[id], {'x_activate_complete': True}]) # call the function 'check_user_login' to see if it works result = check_user_login(custom_email, custom_password) return(result)