odooodoo-8

List All the countries in a specific language


I need to list all the countries in the French Language.

all_countries = self.env['res.country'].search([])
for country in all_countries:
   _logger.error(country.name)

With this code i get the Country English Name.How to get the French one?


Solution

  • As far as I know, there is no reference between country and languages. You have to get the list by external modules. Try pycountry, get the list of country code (by language code fr-*), then search for matches in res.country.

    Or you can override res.country and add language reference your self :)