{"id":1980,"date":"2025-02-11T23:25:37","date_gmt":"2025-02-11T22:25:37","guid":{"rendered":"https:\/\/hobbykeller.spdns.de\/?p=1980"},"modified":"2025-02-11T23:25:37","modified_gmt":"2025-02-11T22:25:37","slug":"tryton-country-module","status":"publish","type":"post","link":"https:\/\/hobbykeller.spdns.de\/?p=1980","title":{"rendered":"Tryton country module"},"content":{"rendered":"\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-info\" role=\"alert\">This documentation refers to the Tryton 7.0 Docker installation.<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">\u00d7<\/span><\/button><\/div>\n\n\n\n<p>The <code>country<\/code> module keeps a list of <strong>pre-defined country names<\/strong>. It features a <strong>high granularity<\/strong> and is aware of provinces, districts etc. for rather exotic countries. The advantage of installing the module is to have a <strong>curated list of countries<\/strong> ready to pick from whenever a country information (e.g. for a Party address) has to be entered.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installation<\/h2>\n\n\n\n<p>Given sufficient admin rights, the Tryton country module can simply be installed from the Modules menu:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open the Modules list<\/li>\n\n\n\n<li>Activate the <strong>check box<\/strong> of the <code>currency<\/code> entry<\/li>\n\n\n\n<li>Click on the <strong>Fan button<\/strong> to trigger the installation<\/li>\n<\/ul>\n\n\n\n<p>There is no necessity to explicitly run a command like <code>trytond-admin --update-modules-list<\/code> but it can&#8217;t do any harm either.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The great disappointment<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">The country list is empty&#8230;<\/h3>\n\n\n\n<p>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.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">&#8230; but can be downloaded<\/h3>\n\n\n\n<p>Does this mean we have to enter every country by hand. Fortunately not, we can <a href=\"https:\/\/docs.tryton.org\/latest\/modules-country\/setup.html#loading-and-updating-countries-and-subdivisions\">download a curated list<\/a> with countries, organizations, translations&#8230; everything we need. Here&#8217;s how it works:<\/p>\n\n\n\n<p>Bash into the docker container running the Tryton app: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ilek@i5:~\/docker\/tryton$ docker exec -it tryton-app-1 bash<\/code><\/pre>\n\n\n\n<p>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 <code>tryton_db<\/code>):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>trytond@c422d25a6451:\/$ trytond_import_countries -c \/etc\/trytond.conf -d tryton_db<\/code><\/pre>\n\n\n\n<p>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.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"width:200 toolbar:2 show-lang:2 lang:default decode:true \" title=\"Installation output of country module\" >trytond@c422d25a6451:\/$ trytond_import_countries -c \/etc\/trytond.conf -d tryton_db\n\/usr\/lib\/python3\/dist-packages\/passlib\/utils\/__init__.py:854: DeprecationWarning: 'crypt' is deprecated and slated for removal in Python 3.13\n  from crypt import crypt as _crypt\n&lt;frozen importlib._bootstrap&gt;:1049: ImportWarning: PluginImportFixer.find_spec() not found; falling back to find_module()\n\/usr\/lib\/python3\/dist-packages\/zeep\/utils.py:1: DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13\n  import cgi\n\/usr\/local\/lib\/python3.11\/dist-packages\/braintree\/dispute.py:83: DeprecationWarning: Use ProtectionLevel enum instead\n  warnings.warn(\"Use ProtectionLevel enum instead\", DeprecationWarning)\n\/usr\/local\/lib\/python3.11\/dist-packages\/braintree\/search.py:79: DeprecationWarning: Use protection_level parameter instead\n  warnings.warn(\"Use protection_level parameter instead\", DeprecationWarning)\n\/usr\/local\/lib\/python3.11\/dist-packages\/trytond\/backend\/postgresql\/database.py:246: UserWarning: The path specified in the URI will be overridden\n  warnings.warn(\"The path specified in the URI will be overridden\")\nUpdate countries\nUpdate subdivisions\nUnknown subdivision type: European collectivity\nUnknown subdivision type: Overseas departmental collectivity\nUnknown subdivision type: Overseas unique territorial collectivity\nUnknown subdivision type: State city\nUnknown subdivision type: Federal entity\nUpdate subdivisions parent\nUpdate subdivisions en\nUpdate subdivisions de\nUpdate subdivisions fr\n<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>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<span class=\"more-button\"><a href=\"https:\/\/hobbykeller.spdns.de\/?p=1980\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\">Tryton country module<\/span><\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[374,64],"tags":[338,375],"class_list":["post-1980","post","type-post","status-publish","format-standard","hentry","category-erp","category-linux","tag-docker","tag-tryton"],"_links":{"self":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1980","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1980"}],"version-history":[{"count":1,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1980\/revisions"}],"predecessor-version":[{"id":1981,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1980\/revisions\/1981"}],"wp:attachment":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1980"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1980"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1980"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}