{"id":1982,"date":"2025-02-16T17:42:09","date_gmt":"2025-02-16T16:42:09","guid":{"rendered":"https:\/\/hobbykeller.spdns.de\/?p=1982"},"modified":"2025-02-16T19:49:31","modified_gmt":"2025-02-16T18:49:31","slug":"tryton-currency-module","status":"publish","type":"post","link":"https:\/\/hobbykeller.spdns.de\/?p=1982","title":{"rendered":"Tryton currency module"},"content":{"rendered":"\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-info\" role=\"alert\">These instructions refer to the Docker image of the <a href=\"https:\/\/hub.docker.com\/layers\/tryton\/tryton\/7.0\/images\/sha256-9947ef6cb677b7e29d7432572b6328caae0bb4f72554066fe58ea9e15c55b6e0\">tryton\/tryton:7.0<\/a> image.<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 Tryton currency module offers a <strong>curated list of all major world currencies<\/strong> with ISO codes and offcial names (plus translations). On top of that,  it allows to <strong>download current FX conversion rates<\/strong> from the ECB into the Tryton database. These conversion rates can then be used for accounting purposes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installation<\/h2>\n\n\n\n<p>The installation works exactly the same way as in the <a href=\"https:\/\/hobbykeller.spdns.de\/?p=1980\" data-type=\"post\" data-id=\"1980\">country module<\/a>: In the <strong>Adminstration<\/strong> panel, click on the <strong>Modules<\/strong> subsection, then scroll down the list to the <code>country<\/code> entry, activate the <strong>checkbox<\/strong> and then hit the <strong>Fan button<\/strong> to trigger the activation. If the module activates successfully you should see <code>Activated<\/code> in the <code>State<\/code> column.<\/p>\n\n\n\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-info\" role=\"alert\">In case you wonder if you should go for the <code>currency<\/code>, the <code>currency_ro<\/code> or the <code>currency_rs<\/code> module, my recommendation is to go for the <code>currency<\/code> module. The (main) difference between these modules is from where current FX rates will be downloaded: <code>currency<\/code> looks up the rates from the ECB database, <code>currency_ro<\/code> downloads the rates from the Romanian central bank and <code>currency_rs<\/code> module sources the rates from the Serbian national bank.<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">\u00d7<\/span><\/button><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Downloading the curated list<\/h3>\n\n\n\n<p>As with the country module, the module activation alone won&#8217;t get you a curated list of world currencies. You can check this by clicking on Currencies in the Currencies section of the side panel. The list will be empty. Instead of entering currencies manually, bash into the container running the Tryton application :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ilek@i5:~$ docker exec -it tryton-app-1 bash<\/code><\/pre>\n\n\n\n<p>And then proceed as instructed on the module&#8217;s official <a href=\"https:\/\/docs.tryton.org\/7.0\/modules-currency\/setup.html#loading-and-updating-currencies\">setup page<\/a> of the module. Assuming that our Tryton database is tryton_db the command should be:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>trytond_import_currencies -c \/etc\/trytond.conf -d tryton_db<\/code><\/pre>\n\n\n\n<p>You might get a couple of deprecation warnings during the installation, but the operation will run fine. On the Tryton web GUI, an info box will pop up that the system will be upgraded. Click OK and the GUI will resume normal operation shortly after that.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Configuration<\/h2>\n\n\n\n<p>After the installation, click <strong>Currencies<\/strong> \/ <strong>Currencies<\/strong> from the menu. What you will see is the list of all currencies that Tryton automatically set up in the previous step together with their current rates. As no current rates have been downloaded yet, they will all show zero:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2025\/02\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1007\" height=\"519\" src=\"https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2025\/02\/image.png\" alt=\"\" class=\"wp-image-1984\" srcset=\"https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2025\/02\/image.png 1007w, https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2025\/02\/image-300x155.png 300w, https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2025\/02\/image-768x396.png 768w\" sizes=\"auto, (max-width: 1007px) 100vw, 1007px\" \/><\/a><figcaption class=\"wp-element-caption\">Currencies overview with all currencies and current rates<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Setting the base currency<\/h3>\n\n\n\n<p>What is a bit confusing in Tryton is that exchange rates normally come in pairs whereas the present list of currencies only has single entries. Therefore we first need to set a <strong>base currency<\/strong>. As per the Tryton docs, it is best practise to first <a href=\"https:\/\/hub.docker.com\/layers\/tryton\/tryton\/7.0\/images\/sha256-9947ef6cb677b7e29d7432572b6328caae0bb4f72554066fe58ea9e15c55b6e0\">set up a base currency by setting its exchange rate to 1<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-info\" role=\"alert\">Quick definition for the avoidance of confusion: The <strong>base currency<\/strong> is one unit of the currency you want to buy with the (other) quoted currency. The <strong>exchange rate<\/strong> is the amount of the (other) quoted currency that you have to give for one unit of the base currency.<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">\u00d7<\/span><\/button><\/div>\n\n\n\n<p>We therefore filter the Currencies list for our desired base currency (in this case EUR) and double click the <strong>EUR line<\/strong> in the list, which opens a sub-window. In the lower part there is a box called <strong>Rates<\/strong>, which holds the time series with all rates contained in the database:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2025\/02\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"617\" height=\"157\" src=\"https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2025\/02\/image-1.png\" alt=\"\" class=\"wp-image-1985\" srcset=\"https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2025\/02\/image-1.png 617w, https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2025\/02\/image-1-300x76.png 300w\" sizes=\"auto, (max-width: 617px) 100vw, 617px\" \/><\/a><figcaption class=\"wp-element-caption\">Manual addition of rates<\/figcaption><\/figure>\n\n\n\n<p>Click on the little <strong>plus sign<\/strong> and another window will open to enter a rate. Enter a <strong>Date<\/strong> far in the past (e.g. 01\/01\/2024) with <strong>Rate<\/strong> 1.0 and click <strong>Add<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Automatic download of rates<\/h3>\n\n\n\n<p>To spare ourselves the tedious work of manually entering exchange rates, we can set up an automatic download from the ECB exchange rate database.<\/p>\n\n\n\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-warning\" role=\"alert\">Keep in mind that the ECB database only daily snapshots of <a href=\"https:\/\/www.ecb.europa.eu\/stats\/policy_and_exchange_rates\/euro_reference_exchange_rates\/html\/index.en.html\">a couple of dozen major currencies<\/a>. Less common currencies such as the GCS or XOF are <strong>not supplied by the ECB<\/strong> and <strong>have to be entered manually<\/strong>. <button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">\u00d7<\/span><\/button><\/div>\n\n\n\n<p>To set up automatic download, proceed as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Click <strong>Currencies<\/strong> \/ <strong>Scheduled Rate Updates<\/strong> in the navigation pane<\/li>\n\n\n\n<li>To set up a download source, click the <strong>plus sign<\/strong> which opens another window:<\/li>\n\n\n\n<li>Pick <strong>European Central Bank<\/strong> from the <strong>Source<\/strong> list<\/li>\n\n\n\n<li>Set <strong>Frequency<\/strong> to <strong>Daily<\/strong> (or whatever suits, in case of other frequencies further parameters have to be specified)<\/li>\n\n\n\n<li>The <strong>Currency<\/strong> field is a bit confusing. What is meant is the <strong>base currency<\/strong> (as can be seen from the explanation that pops up when hovering over the field). Although we have set the base currency in the previous step we have to specify it again, so enter EUR.<\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-info\" role=\"alert\">If you wonder why you should have to specify the base currency again, the answer is: The Tryton currency module is smarter than you think. It has <strong>cross rate functionality <\/strong>which allows to compute rates such as USDGBP (i.e. Sterling against USD as base currency). While the ECB database does not contain USDGBP (called &#8220;the cable&#8221; by forex traders, btw) it contains EURUSD and EURGBP. The Tryton module can use these two rates to <strong>calculate the implied<\/strong> USDGBP rate.<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">\u00d7<\/span><\/button><\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In the lower part of a window, there is a section called <strong>Currencies<\/strong> with a table that has the columns Name, Code and Current Rate. Click on the Plus sign at the right top of the table. (Unlike the other plus buttons it is not the conventional white cross on dark background but a standard plus sign in black in grey background. If you hover over that cross, an explanation saying &#8220;Add existing record&#8221; pops up.)<\/li>\n\n\n\n<li>You can now add foreign currencies for which you want to have quotes from the date source. Once again, keep in mind that the ECB offers only a limited set of quotes for major world currencies. Check at the<a href=\"https:\/\/www.ecb.europa.eu\/stats\/policy_and_exchange_rates\/euro_reference_exchange_rates\/html\/index.en.html\"> ECB web page<\/a> if the quote of the desired foreign currency against the euro is available.<\/li>\n\n\n\n<li>Once you have entered all currencies that you want to have quoted against the base currency, click the <strong>save icon<\/strong> in the window.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Your Current Rate column will probably still show zeros. To force an update, enter a <strong>date from the past<\/strong> in the <strong>Last Update<\/strong> field and Click the <strong>Run<\/strong> button. Any current rate that can be retrieved will be updated. <\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2025\/02\/image-4.png\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"415\" src=\"https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2025\/02\/image-4.png\" alt=\"\" class=\"wp-image-1988\" srcset=\"https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2025\/02\/image-4.png 720w, https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2025\/02\/image-4-300x173.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Tryton currency module offers a curated list of all major world currencies with ISO codes and offcial names (plus translations). On top of that, it allows to download current<span class=\"more-button\"><a href=\"https:\/\/hobbykeller.spdns.de\/?p=1982\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\">Tryton currency 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,254],"tags":[375],"class_list":["post-1982","post","type-post","status-publish","format-standard","hentry","category-erp","category-python","tag-tryton"],"_links":{"self":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1982","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=1982"}],"version-history":[{"count":4,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1982\/revisions"}],"predecessor-version":[{"id":1991,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1982\/revisions\/1991"}],"wp:attachment":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1982"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1982"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1982"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}