Site Overlay

Tryton country module

The country module keeps a list of pre-defined country names. It features a high granularity and is aware of provinces, districts etc. for rather exotic countries. The advantage of installing the module is to have a curated list of countries ready to pick from whenever a country information (e.g. for a Party address) has to be entered.

Installation

Given sufficient admin rights, the Tryton country module can simply be installed from the Modules menu:

  • Open the Modules list
  • Activate the check box of the currency entry
  • Click on the Fan button to trigger the installation

There is no necessity to explicitly run a command like trytond-admin --update-modules-list but it can’t do any harm either.

The great disappointment

The country list is empty…

If you expect to get a complete list of countries whenever you click into a country field in a mask (such as in the Party mask) you are in for a fat disappointment: Nothing is populated at all. All that the country module has so far done is that there is a Countries subsection of the adminstration menu with an empty countries list.

… but can be downloaded

Does this mean we have to enter every country by hand. Fortunately not, we can download a curated list with countries, organizations, translations… everything we need. Here’s how it works:

Bash into the docker container running the Tryton app:

ilek@i5:~/docker/tryton$ docker exec -it tryton-app-1 bash

Inside the Docker container run the following command that downloads the curated country data from a remote source into your Tryton database (which we assume has the name tryton_db):

trytond@c422d25a6451:/$ trytond_import_countries -c /etc/trytond.conf -d tryton_db

The messages you get while downloading are quite verbose, contain some warnings about Python modules that are scheduled for deprecation. Still there are no errors or show stoppers.

trytond@c422d25a6451:/$ trytond_import_countries -c /etc/trytond.conf -d tryton_db
/usr/lib/python3/dist-packages/passlib/utils/__init__.py:854: DeprecationWarning: 'crypt' is deprecated and slated for removal in Python 3.13
  from crypt import crypt as _crypt
<frozen importlib._bootstrap>:1049: ImportWarning: PluginImportFixer.find_spec() not found; falling back to find_module()
/usr/lib/python3/dist-packages/zeep/utils.py:1: DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13
  import cgi
/usr/local/lib/python3.11/dist-packages/braintree/dispute.py:83: DeprecationWarning: Use ProtectionLevel enum instead
  warnings.warn("Use ProtectionLevel enum instead", DeprecationWarning)
/usr/local/lib/python3.11/dist-packages/braintree/search.py:79: DeprecationWarning: Use protection_level parameter instead
  warnings.warn("Use protection_level parameter instead", DeprecationWarning)
/usr/local/lib/python3.11/dist-packages/trytond/backend/postgresql/database.py:246: UserWarning: The path specified in the URI will be overridden
  warnings.warn("The path specified in the URI will be overridden")
Update countries
Update subdivisions
Unknown subdivision type: European collectivity
Unknown subdivision type: Overseas departmental collectivity
Unknown subdivision type: Overseas unique territorial collectivity
Unknown subdivision type: State city
Unknown subdivision type: Federal entity
Update subdivisions parent
Update subdivisions en
Update subdivisions de
Update subdivisions fr