Source code for odoo_xmlrpc_twisted.functions.get_available_countries

"""
Give back all available countries from Odoo system.
"""

# call the function "get_settings_odoo" to get the parameters
# for the logging of the model on the "odoo Webservice API"
try:
    from .get_settings_odoo import get_settings_odoo
except ImportError:
    from get_settings_odoo import get_settings_odoo
result   = get_settings_odoo()
db       = result[0]
uid      = result[1]
password = result[3]
models   = result[4] 


[docs] def get_available_countries(): """ Get the available countries from Odoo system by getting it from the 'res.country' model. Result is an array with id and the name of the countries. """ # Call the search_read method of the res.country model to get countries countries = models.execute_kw(db, uid, password, 'res.country', 'search_read', [[]], {'fields': ['id', 'name']}) return(countries)