From 9910de243d910a9a8b64fde4c02b4295965c70d2 Mon Sep 17 00:00:00 2001 From: eLBati Date: Wed, 24 Feb 2021 17:23:18 +0100 Subject: [PATCH 1/9] ADD currency_rate_update_boi - Currency Rate Update: Bank of Italy --- currency_rate_update_boi/README.rst | 117 +++++ currency_rate_update_boi/__init__.py | 1 + currency_rate_update_boi/__manifest__.py | 21 + .../i18n/currency_rate_update_boi.pot | 35 ++ currency_rate_update_boi/models/__init__.py | 1 + .../models/res_currency_rate_provider_BOI.py | 88 ++++ currency_rate_update_boi/readme/CONFIGURE.rst | 9 + .../readme/CONTRIBUTORS.rst | 6 + .../readme/DESCRIPTION.rst | 19 + .../static/description/icon.png | Bin 0 -> 7271 bytes .../static/description/index.html | 447 ++++++++++++++++++ 11 files changed, 744 insertions(+) create mode 100644 currency_rate_update_boi/README.rst create mode 100644 currency_rate_update_boi/__init__.py create mode 100644 currency_rate_update_boi/__manifest__.py create mode 100644 currency_rate_update_boi/i18n/currency_rate_update_boi.pot create mode 100644 currency_rate_update_boi/models/__init__.py create mode 100644 currency_rate_update_boi/models/res_currency_rate_provider_BOI.py create mode 100644 currency_rate_update_boi/readme/CONFIGURE.rst create mode 100644 currency_rate_update_boi/readme/CONTRIBUTORS.rst create mode 100644 currency_rate_update_boi/readme/DESCRIPTION.rst create mode 100644 currency_rate_update_boi/static/description/icon.png create mode 100644 currency_rate_update_boi/static/description/index.html diff --git a/currency_rate_update_boi/README.rst b/currency_rate_update_boi/README.rst new file mode 100644 index 000000000000..1fb3ecfa8cf9 --- /dev/null +++ b/currency_rate_update_boi/README.rst @@ -0,0 +1,117 @@ +==================================== +Currency Rate Update: Banca d'Italia +==================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github + :target: https://github.com/OCA/l10n-italy/tree/12.0/currency_rate_update_boi + :alt: OCA/l10n-italy +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/l10n-italy-12-0/l10n-italy-12-0-currency_rate_update_boi + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/122/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +**Italiano** + +Questo modulo aggiunge la `Banca d'Italia `_ +come fornitore dei tassi di cambio. + +Le istruzioni per l'esportazione dei dati sono disponibili all'indirizzo +https://tassidicambio.bancaditalia.it/terzevalute-wf-ui-web/assets/files/Operating_Instructions.pdf + +I tassi di cambio sono esportati nel formato JSON. + +**English** + +This module adds `Bank of Italy `_ +currency exchange rates provider. + +Data export instructions are available at +https://tassidicambio.bancaditalia.it/terzevalute-wf-ui-web/assets/files/Operating_Instructions.pdf + +Exchange rates are exported in JSON format. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +**Italiano** + +Suggeriamo di eseguire l'azione pianificata "Aggiornamento tassi di cambio (OCA) giornaliero" alla fine del giorno, +per essere sicuri che la Banca d'Italia abbia aggiornato i dati. + +**English** + +We suggest to execute the "Currency Rates Update (OCA) daily" cron at the end of the day, +to be sure that Bank of Italy updated the data. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* TAKOBI + +Contributors +~~~~~~~~~~~~ + +* Giacomo Grasso +* Gabriele Baldessari + +* `TAKOBI `_: + + * Lorenzo Battistini + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-eLBati| image:: https://github.com/eLBati.png?size=40px + :target: https://github.com/eLBati + :alt: eLBati + +Current `maintainer `__: + +|maintainer-eLBati| + +This module is part of the `OCA/l10n-italy `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/currency_rate_update_boi/__init__.py b/currency_rate_update_boi/__init__.py new file mode 100644 index 000000000000..0650744f6bc6 --- /dev/null +++ b/currency_rate_update_boi/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/currency_rate_update_boi/__manifest__.py b/currency_rate_update_boi/__manifest__.py new file mode 100644 index 000000000000..744f857ce2e0 --- /dev/null +++ b/currency_rate_update_boi/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2021 Lorenzo Battistini @ TAKOBI +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + 'name': 'Currency Rate Update: Banca d\'Italia', + 'version': '12.0.1.0.0', + 'category': 'Financial Management/Configuration', + 'summary': 'Update exchange rates using www.bancaditalia.it', + 'author': + 'TAKOBI, ' + 'Odoo Community Association (OCA)', + 'maintainers': ['eLBati'], + 'license': 'AGPL-3', + 'installable': True, + 'application': False, + 'depends': [ + 'currency_rate_update', + ], + 'data': [ + ], +} diff --git a/currency_rate_update_boi/i18n/currency_rate_update_boi.pot b/currency_rate_update_boi/i18n/currency_rate_update_boi.pot new file mode 100644 index 000000000000..2b77615b479d --- /dev/null +++ b/currency_rate_update_boi/i18n/currency_rate_update_boi.pot @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * currency_rate_update_boi +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: currency_rate_update_boi +#: selection:res.currency.rate.provider,service:0 +msgid "Bank of Italy" +msgstr "" + +#. module: currency_rate_update_boi +#: model:ir.model,name:currency_rate_update_boi.model_res_currency_rate_provider +msgid "Currency Rates Provider" +msgstr "" + +#. module: currency_rate_update_boi +#: selection:res.currency.rate.provider,service:0 +msgid "European Central Bank" +msgstr "" + +#. module: currency_rate_update_boi +#: model:ir.model.fields,field_description:currency_rate_update_boi.field_res_currency_rate_provider__service +msgid "Source Service" +msgstr "" + diff --git a/currency_rate_update_boi/models/__init__.py b/currency_rate_update_boi/models/__init__.py new file mode 100644 index 000000000000..429f804cde54 --- /dev/null +++ b/currency_rate_update_boi/models/__init__.py @@ -0,0 +1 @@ +from . import res_currency_rate_provider_BOI diff --git a/currency_rate_update_boi/models/res_currency_rate_provider_BOI.py b/currency_rate_update_boi/models/res_currency_rate_provider_BOI.py new file mode 100644 index 000000000000..dd83cde22e4d --- /dev/null +++ b/currency_rate_update_boi/models/res_currency_rate_provider_BOI.py @@ -0,0 +1,88 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from datetime import timedelta +import requests + +from odoo import models, fields, api +from odoo.tools.safe_eval import safe_eval + + +class ResCurrencyRateProviderBOI(models.Model): + _inherit = 'res.currency.rate.provider' + + service = fields.Selection( + selection_add=[('BOI', 'Bank of Italy')], + ) + + @api.multi + def _get_supported_currencies(self): + self.ensure_one() + if self.service != 'BOI': + return super()._get_supported_currencies() # pragma: no cover + + return [ + "AFN", "ALL", "DZD", "ADP", "AOA", "XCD", "ANG", "SAR", "ARS", "AMD", + "AWG", "AUD", "ATS", "AZN", "AZM", "BSD", "BHD", "BDT", "BBD", "BEF", + "BZD", "XOF", "BMD", "BTN", "BYB", "BYN", "BYR", "BOB", "BAM", "BWP", + "BRL", "BND", "BGL", "BGN", "XOF", "BIF", "KHR", "XAF", "CAD", "CVE", + "KYD", "CZK", "CSK", "XAF", "XAF", "CLP", "CNY", "CYP", "COP", "KMF", + "XAF", "ZRN", "CDF", "KPW", "KRW", "XOF", "CRC", "HRK", "CUP", "DKK", + "XCD", "DOP", "ECS", "EGP", "SVC", "AED", "ERN", "EEK", "ETB", "FKP", + "FJD", "PHP", "FIM", "XDR", "FRF", "XAF", "GMD", "GEL", "DEM", "DDM", + "GHS", "GHC", "JMD", "JPY", "GIP", "DJF", "JOD", "GRD", "XCD", "GTQ", + "GNF", "GWP", "XOF", "XAF", "GQE", "GYD", "HTG", "HNL", "HKD", "INR", + "IDR", "IRR", "IQD", "IEP", "ISK", "ILS", "ITL", "YUM", "KZT", "KES", + "KGS", "KWD", "LAK", "LSL", "LVL", "LBP", "LRD", "LYD", "LTL", "LUF", + "MOP", "MKD", "MGA", "MGF", "MWK", "MYR", "MVR", "XOF", "MLF", "MTL", + "MAD", "MRO", "MUR", "MXN", "MDL", "MNT", "MZM", "MZN", "MMK", "NAD", + "NPR", "NIO", "XOF", "NGN", "NOK", "NZD", "NLG", "OMR", "PKR", "PAB", + "PGK", "PYG", "PEN", "XPF", "PLN", "PTE", "QAR", "GBP", "ROL", "RON", + "RUB", "RWF", "SBD", "WST", "SHP", "STD", "XOF", "CSD", "RSD", "CSD", + "SCR", "SLL", "SGD", "SYP", "ECU", "SKK", "SIT", "SOS", "ESP", "LKR", + "XCD", "XCD", "USD", "XCD", "ZAR", "SSP", "SDG", "SDD", "SRG", "SRD", + "SEK", "CHF", "SZL", "TJS", "TJR", "TWD", "TZS", "THB", "XOF", "TOP", + "TTD", "TND", "TRY", "TRL", "TMM", "TMT", "UAH", "UGX", "HUF", "EUR", + "SUR", "UYU", "UZS", "VUV", "VEF", "VEB", "VND", "YER", "YDD", "ZMW", + "ZMK", "ZWD", "ZWN", + ] + + @api.multi + def _obtain_rates(self, base_currency, currencies, date_from, date_to): + self.ensure_one() + if self.service != 'BOI': + return super()._obtain_rates(base_currency, currencies, date_from, + date_to) # pragma: no cover + + invert_calculation = False + if base_currency != 'EUR': + invert_calculation = True + if base_currency not in currencies: + currencies.append(base_currency) + content = {} + + while date_from <= date_to: + date_from_str = str(date_from) + + url = ( + "https://tassidicambio.bancaditalia.it/terzevalute-wf-web/" + "rest/v1.0/dailyRates?referenceDate={ref_date}" + "¤cyIsoCode={ref_cur}&lang={lang}".format( + ref_date=date_from_str, + ref_cur='EUR', + lang='EN', + )) + response = requests.get(url, headers={'Accept': 'application/json'}) + curr_dict = response.content + content[date_from_str] = {} + for row in safe_eval(curr_dict)['rates']: + if row['isoCode'] in currencies: + content[date_from_str][row['isoCode']] = row['avgRate'] + date_from += timedelta(days=1) + + if invert_calculation: + for k in content.keys(): + base_rate = float(content[k][base_currency]) + for rate in content[k].keys(): + content[k][rate] = str(float(content[k][rate])/base_rate) + content[k]['EUR'] = str(1.0/base_rate) + return content diff --git a/currency_rate_update_boi/readme/CONFIGURE.rst b/currency_rate_update_boi/readme/CONFIGURE.rst new file mode 100644 index 000000000000..2f239132b403 --- /dev/null +++ b/currency_rate_update_boi/readme/CONFIGURE.rst @@ -0,0 +1,9 @@ +**Italiano** + +Suggeriamo di eseguire l'azione pianificata "Aggiornamento tassi di cambio (OCA) giornaliero" alla fine del giorno, +per essere sicuri che la Banca d'Italia abbia aggiornato i dati. + +**English** + +We suggest to execute the "Currency Rates Update (OCA) daily" cron at the end of the day, +to be sure that Bank of Italy updated the data. diff --git a/currency_rate_update_boi/readme/CONTRIBUTORS.rst b/currency_rate_update_boi/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..9d7555a93d80 --- /dev/null +++ b/currency_rate_update_boi/readme/CONTRIBUTORS.rst @@ -0,0 +1,6 @@ +* Giacomo Grasso +* Gabriele Baldessari + +* `TAKOBI `_: + + * Lorenzo Battistini diff --git a/currency_rate_update_boi/readme/DESCRIPTION.rst b/currency_rate_update_boi/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..8e2933aef52a --- /dev/null +++ b/currency_rate_update_boi/readme/DESCRIPTION.rst @@ -0,0 +1,19 @@ +**Italiano** + +Questo modulo aggiunge la `Banca d'Italia `_ +come fornitore dei tassi di cambio. + +Le istruzioni per l'esportazione dei dati sono disponibili all'indirizzo +https://tassidicambio.bancaditalia.it/terzevalute-wf-ui-web/assets/files/Operating_Instructions.pdf + +I tassi di cambio sono esportati nel formato JSON. + +**English** + +This module adds `Bank of Italy `_ +currency exchange rates provider. + +Data export instructions are available at +https://tassidicambio.bancaditalia.it/terzevalute-wf-ui-web/assets/files/Operating_Instructions.pdf + +Exchange rates are exported in JSON format. diff --git a/currency_rate_update_boi/static/description/icon.png b/currency_rate_update_boi/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..9333e33755a78cb99c26005c22aeb66df14a41e2 GIT binary patch literal 7271 zcmV-t9GK&YP)2^TAKh~od8&x09Kg*QkSa0)&NwPkFConKtUfmJp29reu|6$D=zZ$ z^YQlj0A`{fN>|_N^0mz0B0D_i@b-9~!Pn&O7&bT*F*28*pHOUelBTaRai_=G=TU;N zw!gxfy3{#*u7jz_W|zLb(&Hm=r=q{tT#vaic&yOh>#V@lUuFogHyJ-i03|3;U}3hr zyM&^{V0eOmlbk|cX8^@RCt{2 zT?>2KNV1jO4~eJNmLd?y6ATs)@z~fNKSaRJnAx3iHjlaY|NofV-PMv>0&LGFV#r)- zzi&1)80pZ}Ri~<}OPY3&gB;`_2RX<=4swu#9ONJeImkf{a*%@@Hwq+~2Nz|MZy2sqg!5o~~0wR=3(GhFPhUN)^*Era}8Jyw7iy z>xX&0>3?~5`}B1C?#sMctIt1muEbkj&_{$4eR??vg2CjBVB%c6;G4*zOkKaY^S2YIoIzRfZcI5x0wXlvZ^PsvqgCDxPy20-ycgxz*(b0K+*!r9x zZLR&yh|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;`_2RX<=4swu#9OVDK{2$**bPSM?w^9HA002ovPDHLkV1oZ7 B3# + + + + + +Currency Rate Update: Banca d'Italia + + + +
+

Currency Rate Update: Banca d’Italia

+ + +

Beta License: AGPL-3 OCA/l10n-italy Translate me on Weblate Try me on Runbot

+

Italiano

+

Questo modulo aggiunge la Banca d’Italia +come fornitore dei tassi di cambio.

+

Le istruzioni per l’esportazione dei dati sono disponibili all’indirizzo +https://tassidicambio.bancaditalia.it/terzevalute-wf-ui-web/assets/files/Operating_Instructions.pdf

+

I tassi di cambio sono esportati nel formato JSON.

+

English

+

This module adds Bank of Italy +currency exchange rates provider.

+

Data export instructions are available at +https://tassidicambio.bancaditalia.it/terzevalute-wf-ui-web/assets/files/Operating_Instructions.pdf

+

Exchange rates are exported in JSON format.

+

Table of contents

+ +
+

Configuration

+

Italiano

+

Suggeriamo di eseguire l’azione pianificata “Aggiornamento tassi di cambio (OCA) giornaliero” alla fine del giorno, +per essere sicuri che la Banca d’Italia abbia aggiornato i dati.

+

English

+

We suggest to execute the “Currency Rates Update (OCA) daily” cron at the end of the day, +to be sure that Bank of Italy updated the data.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • TAKOBI
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainer:

+

eLBati

+

This module is part of the OCA/l10n-italy project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + From c21789d8b1bf69f930ffb6045e1e56ae27cfbb65 Mon Sep 17 00:00:00 2001 From: Sergio Corato Date: Mon, 31 May 2021 17:29:12 +0000 Subject: [PATCH 2/9] Added translation using Weblate (Italian) --- currency_rate_update_boi/i18n/it.po | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 currency_rate_update_boi/i18n/it.po diff --git a/currency_rate_update_boi/i18n/it.po b/currency_rate_update_boi/i18n/it.po new file mode 100644 index 000000000000..b3e23a711ec2 --- /dev/null +++ b/currency_rate_update_boi/i18n/it.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * currency_rate_update_boi +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#. module: currency_rate_update_boi +#: selection:res.currency.rate.provider,service:0 +msgid "Bank of Italy" +msgstr "" + +#. module: currency_rate_update_boi +#: model:ir.model,name:currency_rate_update_boi.model_res_currency_rate_provider +msgid "Currency Rates Provider" +msgstr "" + +#. module: currency_rate_update_boi +#: selection:res.currency.rate.provider,service:0 +msgid "European Central Bank" +msgstr "" + +#. module: currency_rate_update_boi +#: model:ir.model.fields,field_description:currency_rate_update_boi.field_res_currency_rate_provider__service +msgid "Source Service" +msgstr "" From 0b727e471e8145d2465a8a8e911dbd80f0d12f54 Mon Sep 17 00:00:00 2001 From: Sergio Corato Date: Mon, 31 May 2021 17:30:24 +0000 Subject: [PATCH 3/9] Translated using Weblate (Italian) Currently translated at 100.0% (4 of 4 strings) Translation: l10n-italy-12.0/l10n-italy-12.0-currency_rate_update_boi Translate-URL: https://translation.odoo-community.org/projects/l10n-italy-12-0/l10n-italy-12-0-currency_rate_update_boi/it/ --- currency_rate_update_boi/i18n/it.po | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/currency_rate_update_boi/i18n/it.po b/currency_rate_update_boi/i18n/it.po index b3e23a711ec2..4cbe5e5ce237 100644 --- a/currency_rate_update_boi/i18n/it.po +++ b/currency_rate_update_boi/i18n/it.po @@ -6,30 +6,32 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2021-05-31 19:48+0000\n" +"Last-Translator: Sergio Corato \n" "Language-Team: none\n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" #. module: currency_rate_update_boi #: selection:res.currency.rate.provider,service:0 msgid "Bank of Italy" -msgstr "" +msgstr "Banca d'Italia" #. module: currency_rate_update_boi #: model:ir.model,name:currency_rate_update_boi.model_res_currency_rate_provider msgid "Currency Rates Provider" -msgstr "" +msgstr "Provider Cambi Valuta" #. module: currency_rate_update_boi #: selection:res.currency.rate.provider,service:0 msgid "European Central Bank" -msgstr "" +msgstr "Banca Centrale Europea" #. module: currency_rate_update_boi #: model:ir.model.fields,field_description:currency_rate_update_boi.field_res_currency_rate_provider__service msgid "Source Service" -msgstr "" +msgstr "Servizio Sorgente" From df82bb6020abed459efc6f41c0823c8d01c3a643 Mon Sep 17 00:00:00 2001 From: Simone Rubino Date: Fri, 5 Aug 2022 16:01:59 +0200 Subject: [PATCH 4/9] currency_rate_update_boi: Add missing key in manifest Pre-commit error is: Error: website key not found in manifest in currency_rate_update_boi. --- currency_rate_update_boi/__manifest__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/currency_rate_update_boi/__manifest__.py b/currency_rate_update_boi/__manifest__.py index 744f857ce2e0..fa422866ffb6 100644 --- a/currency_rate_update_boi/__manifest__.py +++ b/currency_rate_update_boi/__manifest__.py @@ -9,6 +9,7 @@ 'author': 'TAKOBI, ' 'Odoo Community Association (OCA)', + 'website': 'https://github.com/OCA/l10n-italy', 'maintainers': ['eLBati'], 'license': 'AGPL-3', 'installable': True, From 89ad227c10f5a162b4ab470f63fcadf0521a77d4 Mon Sep 17 00:00:00 2001 From: Simone Rubino Date: Fri, 5 Aug 2022 16:05:16 +0200 Subject: [PATCH 5/9] Manually fix manifest website key --- currency_rate_update_boi/__manifest__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/currency_rate_update_boi/__manifest__.py b/currency_rate_update_boi/__manifest__.py index fa422866ffb6..996b7cf756c1 100644 --- a/currency_rate_update_boi/__manifest__.py +++ b/currency_rate_update_boi/__manifest__.py @@ -9,7 +9,8 @@ 'author': 'TAKOBI, ' 'Odoo Community Association (OCA)', - 'website': 'https://github.com/OCA/l10n-italy', + 'website': 'https://github.com/OCA/l10n-italy' + '/tree/12.0/currency_rate_update_boi', 'maintainers': ['eLBati'], 'license': 'AGPL-3', 'installable': True, From c6d8d142ab1fe1a3d93fe9338c68e73921d698f5 Mon Sep 17 00:00:00 2001 From: Roberto Fichera Date: Fri, 17 Feb 2023 14:41:36 +0100 Subject: [PATCH 6/9] [14.0][MIG] currency_rate_update_boi: Migration to 14.0 --- currency_rate_update_boi/README.rst | 10 +- currency_rate_update_boi/__manifest__.py | 31 +- .../i18n/currency_rate_update_boi.pot | 23 +- currency_rate_update_boi/i18n/it.po | 23 +- .../models/res_currency_rate_provider_BOI.py | 285 +++++++++++++++--- .../static/description/index.html | 6 +- 6 files changed, 299 insertions(+), 79 deletions(-) diff --git a/currency_rate_update_boi/README.rst b/currency_rate_update_boi/README.rst index 1fb3ecfa8cf9..6be4cb47bc6f 100644 --- a/currency_rate_update_boi/README.rst +++ b/currency_rate_update_boi/README.rst @@ -14,13 +14,13 @@ Currency Rate Update: Banca d'Italia :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github - :target: https://github.com/OCA/l10n-italy/tree/12.0/currency_rate_update_boi + :target: https://github.com/OCA/l10n-italy/tree/14.0/currency_rate_update_boi :alt: OCA/l10n-italy .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/l10n-italy-12-0/l10n-italy-12-0-currency_rate_update_boi + :target: https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-currency_rate_update_boi :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/122/12.0 + :target: https://runbot.odoo-community.org/runbot/122/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -69,7 +69,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -112,6 +112,6 @@ Current `maintainer `__: |maintainer-eLBati| -This module is part of the `OCA/l10n-italy `_ project on GitHub. +This module is part of the `OCA/l10n-italy `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/currency_rate_update_boi/__manifest__.py b/currency_rate_update_boi/__manifest__.py index 996b7cf756c1..8b8499ae5641 100644 --- a/currency_rate_update_boi/__manifest__.py +++ b/currency_rate_update_boi/__manifest__.py @@ -2,22 +2,19 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { - 'name': 'Currency Rate Update: Banca d\'Italia', - 'version': '12.0.1.0.0', - 'category': 'Financial Management/Configuration', - 'summary': 'Update exchange rates using www.bancaditalia.it', - 'author': - 'TAKOBI, ' - 'Odoo Community Association (OCA)', - 'website': 'https://github.com/OCA/l10n-italy' - '/tree/12.0/currency_rate_update_boi', - 'maintainers': ['eLBati'], - 'license': 'AGPL-3', - 'installable': True, - 'application': False, - 'depends': [ - 'currency_rate_update', - ], - 'data': [ + "name": "Currency Rate Update: Banca d'Italia", + "version": "14.0.1.0.0", + "category": "Financial Management/Configuration", + "summary": "Update exchange rates using www.bancaditalia.it", + "author": "TAKOBI, " "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/l10n-italy" + "/tree/12.0/currency_rate_update_boi", + "maintainers": ["eLBati"], + "license": "AGPL-3", + "installable": True, + "application": False, + "depends": [ + "currency_rate_update", ], + "data": [], } diff --git a/currency_rate_update_boi/i18n/currency_rate_update_boi.pot b/currency_rate_update_boi/i18n/currency_rate_update_boi.pot index 2b77615b479d..3feb794fea40 100644 --- a/currency_rate_update_boi/i18n/currency_rate_update_boi.pot +++ b/currency_rate_update_boi/i18n/currency_rate_update_boi.pot @@ -1,12 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * currency_rate_update_boi +# * currency_rate_update_boi # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -14,7 +14,7 @@ msgstr "" "Plural-Forms: \n" #. module: currency_rate_update_boi -#: selection:res.currency.rate.provider,service:0 +#: model:ir.model.fields.selection,name:currency_rate_update_boi.selection__res_currency_rate_provider__service__boi msgid "Bank of Italy" msgstr "" @@ -24,12 +24,21 @@ msgid "Currency Rates Provider" msgstr "" #. module: currency_rate_update_boi -#: selection:res.currency.rate.provider,service:0 -msgid "European Central Bank" +#: model:ir.model.fields,field_description:currency_rate_update_boi.field_res_currency_rate_provider__display_name +msgid "Display Name" +msgstr "" + +#. module: currency_rate_update_boi +#: model:ir.model.fields,field_description:currency_rate_update_boi.field_res_currency_rate_provider__id +msgid "ID" +msgstr "" + +#. module: currency_rate_update_boi +#: model:ir.model.fields,field_description:currency_rate_update_boi.field_res_currency_rate_provider____last_update +msgid "Last Modified on" msgstr "" #. module: currency_rate_update_boi #: model:ir.model.fields,field_description:currency_rate_update_boi.field_res_currency_rate_provider__service msgid "Source Service" msgstr "" - diff --git a/currency_rate_update_boi/i18n/it.po b/currency_rate_update_boi/i18n/it.po index 4cbe5e5ce237..6e33e99e23e3 100644 --- a/currency_rate_update_boi/i18n/it.po +++ b/currency_rate_update_boi/i18n/it.po @@ -1,6 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * currency_rate_update_boi +# * currency_rate_update_boi # msgid "" msgstr "" @@ -17,7 +17,7 @@ msgstr "" "X-Generator: Weblate 4.3.2\n" #. module: currency_rate_update_boi -#: selection:res.currency.rate.provider,service:0 +#: model:ir.model.fields.selection,name:currency_rate_update_boi.selection__res_currency_rate_provider__service__boi msgid "Bank of Italy" msgstr "Banca d'Italia" @@ -27,11 +27,24 @@ msgid "Currency Rates Provider" msgstr "Provider Cambi Valuta" #. module: currency_rate_update_boi -#: selection:res.currency.rate.provider,service:0 -msgid "European Central Bank" -msgstr "Banca Centrale Europea" +#: model:ir.model.fields,field_description:currency_rate_update_boi.field_res_currency_rate_provider__display_name +msgid "Display Name" +msgstr "" + +#. module: currency_rate_update_boi +#: model:ir.model.fields,field_description:currency_rate_update_boi.field_res_currency_rate_provider__id +msgid "ID" +msgstr "" + +#. module: currency_rate_update_boi +#: model:ir.model.fields,field_description:currency_rate_update_boi.field_res_currency_rate_provider____last_update +msgid "Last Modified on" +msgstr "" #. module: currency_rate_update_boi #: model:ir.model.fields,field_description:currency_rate_update_boi.field_res_currency_rate_provider__service msgid "Source Service" msgstr "Servizio Sorgente" + +#~ msgid "European Central Bank" +#~ msgstr "Banca Centrale Europea" diff --git a/currency_rate_update_boi/models/res_currency_rate_provider_BOI.py b/currency_rate_update_boi/models/res_currency_rate_provider_BOI.py index dd83cde22e4d..15eb95b45cf4 100644 --- a/currency_rate_update_boi/models/res_currency_rate_provider_BOI.py +++ b/currency_rate_update_boi/models/res_currency_rate_provider_BOI.py @@ -1,60 +1,260 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from datetime import timedelta + import requests -from odoo import models, fields, api +from odoo import fields, models from odoo.tools.safe_eval import safe_eval class ResCurrencyRateProviderBOI(models.Model): - _inherit = 'res.currency.rate.provider' + _inherit = "res.currency.rate.provider" service = fields.Selection( - selection_add=[('BOI', 'Bank of Italy')], + selection_add=[("BOI", "Bank of Italy")], ondelete={"BOI": "cascade"} ) - @api.multi def _get_supported_currencies(self): self.ensure_one() - if self.service != 'BOI': + if self.service != "BOI": return super()._get_supported_currencies() # pragma: no cover return [ - "AFN", "ALL", "DZD", "ADP", "AOA", "XCD", "ANG", "SAR", "ARS", "AMD", - "AWG", "AUD", "ATS", "AZN", "AZM", "BSD", "BHD", "BDT", "BBD", "BEF", - "BZD", "XOF", "BMD", "BTN", "BYB", "BYN", "BYR", "BOB", "BAM", "BWP", - "BRL", "BND", "BGL", "BGN", "XOF", "BIF", "KHR", "XAF", "CAD", "CVE", - "KYD", "CZK", "CSK", "XAF", "XAF", "CLP", "CNY", "CYP", "COP", "KMF", - "XAF", "ZRN", "CDF", "KPW", "KRW", "XOF", "CRC", "HRK", "CUP", "DKK", - "XCD", "DOP", "ECS", "EGP", "SVC", "AED", "ERN", "EEK", "ETB", "FKP", - "FJD", "PHP", "FIM", "XDR", "FRF", "XAF", "GMD", "GEL", "DEM", "DDM", - "GHS", "GHC", "JMD", "JPY", "GIP", "DJF", "JOD", "GRD", "XCD", "GTQ", - "GNF", "GWP", "XOF", "XAF", "GQE", "GYD", "HTG", "HNL", "HKD", "INR", - "IDR", "IRR", "IQD", "IEP", "ISK", "ILS", "ITL", "YUM", "KZT", "KES", - "KGS", "KWD", "LAK", "LSL", "LVL", "LBP", "LRD", "LYD", "LTL", "LUF", - "MOP", "MKD", "MGA", "MGF", "MWK", "MYR", "MVR", "XOF", "MLF", "MTL", - "MAD", "MRO", "MUR", "MXN", "MDL", "MNT", "MZM", "MZN", "MMK", "NAD", - "NPR", "NIO", "XOF", "NGN", "NOK", "NZD", "NLG", "OMR", "PKR", "PAB", - "PGK", "PYG", "PEN", "XPF", "PLN", "PTE", "QAR", "GBP", "ROL", "RON", - "RUB", "RWF", "SBD", "WST", "SHP", "STD", "XOF", "CSD", "RSD", "CSD", - "SCR", "SLL", "SGD", "SYP", "ECU", "SKK", "SIT", "SOS", "ESP", "LKR", - "XCD", "XCD", "USD", "XCD", "ZAR", "SSP", "SDG", "SDD", "SRG", "SRD", - "SEK", "CHF", "SZL", "TJS", "TJR", "TWD", "TZS", "THB", "XOF", "TOP", - "TTD", "TND", "TRY", "TRL", "TMM", "TMT", "UAH", "UGX", "HUF", "EUR", - "SUR", "UYU", "UZS", "VUV", "VEF", "VEB", "VND", "YER", "YDD", "ZMW", - "ZMK", "ZWD", "ZWN", + "AFN", + "ALL", + "DZD", + "ADP", + "AOA", + "XCD", + "ANG", + "SAR", + "ARS", + "AMD", + "AWG", + "AUD", + "ATS", + "AZN", + "AZM", + "BSD", + "BHD", + "BDT", + "BBD", + "BEF", + "BZD", + "XOF", + "BMD", + "BTN", + "BYB", + "BYN", + "BYR", + "BOB", + "BAM", + "BWP", + "BRL", + "BND", + "BGL", + "BGN", + "XOF", + "BIF", + "KHR", + "XAF", + "CAD", + "CVE", + "KYD", + "CZK", + "CSK", + "XAF", + "XAF", + "CLP", + "CNY", + "CYP", + "COP", + "KMF", + "XAF", + "ZRN", + "CDF", + "KPW", + "KRW", + "XOF", + "CRC", + "HRK", + "CUP", + "DKK", + "XCD", + "DOP", + "ECS", + "EGP", + "SVC", + "AED", + "ERN", + "EEK", + "ETB", + "FKP", + "FJD", + "PHP", + "FIM", + "XDR", + "FRF", + "XAF", + "GMD", + "GEL", + "DEM", + "DDM", + "GHS", + "GHC", + "JMD", + "JPY", + "GIP", + "DJF", + "JOD", + "GRD", + "XCD", + "GTQ", + "GNF", + "GWP", + "XOF", + "XAF", + "GQE", + "GYD", + "HTG", + "HNL", + "HKD", + "INR", + "IDR", + "IRR", + "IQD", + "IEP", + "ISK", + "ILS", + "ITL", + "YUM", + "KZT", + "KES", + "KGS", + "KWD", + "LAK", + "LSL", + "LVL", + "LBP", + "LRD", + "LYD", + "LTL", + "LUF", + "MOP", + "MKD", + "MGA", + "MGF", + "MWK", + "MYR", + "MVR", + "XOF", + "MLF", + "MTL", + "MAD", + "MRO", + "MUR", + "MXN", + "MDL", + "MNT", + "MZM", + "MZN", + "MMK", + "NAD", + "NPR", + "NIO", + "XOF", + "NGN", + "NOK", + "NZD", + "NLG", + "OMR", + "PKR", + "PAB", + "PGK", + "PYG", + "PEN", + "XPF", + "PLN", + "PTE", + "QAR", + "GBP", + "ROL", + "RON", + "RUB", + "RWF", + "SBD", + "WST", + "SHP", + "STD", + "XOF", + "CSD", + "RSD", + "CSD", + "SCR", + "SLL", + "SGD", + "SYP", + "ECU", + "SKK", + "SIT", + "SOS", + "ESP", + "LKR", + "XCD", + "XCD", + "USD", + "XCD", + "ZAR", + "SSP", + "SDG", + "SDD", + "SRG", + "SRD", + "SEK", + "CHF", + "SZL", + "TJS", + "TJR", + "TWD", + "TZS", + "THB", + "XOF", + "TOP", + "TTD", + "TND", + "TRY", + "TRL", + "TMM", + "TMT", + "UAH", + "UGX", + "HUF", + "EUR", + "SUR", + "UYU", + "UZS", + "VUV", + "VEF", + "VEB", + "VND", + "YER", + "YDD", + "ZMW", + "ZMK", + "ZWD", + "ZWN", ] - @api.multi def _obtain_rates(self, base_currency, currencies, date_from, date_to): self.ensure_one() - if self.service != 'BOI': - return super()._obtain_rates(base_currency, currencies, date_from, - date_to) # pragma: no cover + if self.service != "BOI": + return super()._obtain_rates( + base_currency, currencies, date_from, date_to + ) # pragma: no cover invert_calculation = False - if base_currency != 'EUR': + if base_currency != "EUR": invert_calculation = True if base_currency not in currencies: currencies.append(base_currency) @@ -68,21 +268,22 @@ def _obtain_rates(self, base_currency, currencies, date_from, date_to): "rest/v1.0/dailyRates?referenceDate={ref_date}" "¤cyIsoCode={ref_cur}&lang={lang}".format( ref_date=date_from_str, - ref_cur='EUR', - lang='EN', - )) - response = requests.get(url, headers={'Accept': 'application/json'}) + ref_cur="EUR", + lang="EN", + ) + ) + response = requests.get(url, headers={"Accept": "application/json"}) curr_dict = response.content content[date_from_str] = {} - for row in safe_eval(curr_dict)['rates']: - if row['isoCode'] in currencies: - content[date_from_str][row['isoCode']] = row['avgRate'] + for row in safe_eval(curr_dict)["rates"]: + if row["isoCode"] in currencies: + content[date_from_str][row["isoCode"]] = row["avgRate"] date_from += timedelta(days=1) if invert_calculation: for k in content.keys(): base_rate = float(content[k][base_currency]) for rate in content[k].keys(): - content[k][rate] = str(float(content[k][rate])/base_rate) - content[k]['EUR'] = str(1.0/base_rate) + content[k][rate] = str(float(content[k][rate]) / base_rate) + content[k]["EUR"] = str(1.0 / base_rate) return content diff --git a/currency_rate_update_boi/static/description/index.html b/currency_rate_update_boi/static/description/index.html index 9e5a6d2e4e07..30af1f8ef33b 100644 --- a/currency_rate_update_boi/static/description/index.html +++ b/currency_rate_update_boi/static/description/index.html @@ -367,7 +367,7 @@

Currency Rate Update: Banca d’Italia

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/l10n-italy Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/l10n-italy Translate me on Weblate Try me on Runbot

Italiano

Questo modulo aggiunge la Banca d’Italia come fornitore dei tassi di cambio.

@@ -407,7 +407,7 @@

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -438,7 +438,7 @@

Maintainers

promote its widespread use.

Current maintainer:

eLBati

-

This module is part of the OCA/l10n-italy project on GitHub.

+

This module is part of the OCA/l10n-italy project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

From a297984609fb93312050020187f82db81b9c7704 Mon Sep 17 00:00:00 2001 From: mymage Date: Mon, 24 Jul 2023 06:16:03 +0000 Subject: [PATCH 7/9] Translated using Weblate (Italian) Currently translated at 100.0% (6 of 6 strings) Translation: l10n-italy-14.0/l10n-italy-14.0-currency_rate_update_boi Translate-URL: https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-currency_rate_update_boi/it/ --- currency_rate_update_boi/README.rst | 15 ++++--- currency_rate_update_boi/i18n/it.po | 12 +++--- .../static/description/index.html | 40 ++++++++++--------- 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/currency_rate_update_boi/README.rst b/currency_rate_update_boi/README.rst index 6be4cb47bc6f..b55c2a7af22d 100644 --- a/currency_rate_update_boi/README.rst +++ b/currency_rate_update_boi/README.rst @@ -2,10 +2,13 @@ Currency Rate Update: Banca d'Italia ==================================== -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:5bdb22c9d941bdf7ebd502bde54b74255a4cc54d14eac7908310510681aa73f2 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status @@ -19,11 +22,11 @@ Currency Rate Update: Banca d'Italia .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png :target: https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-currency_rate_update_boi :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/122/14.0 - :alt: Try me on Runbot +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&target_branch=14.0 + :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| **Italiano** @@ -68,7 +71,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. -If you spotted it first, help us smashing it by providing a detailed and welcomed +If you spotted it first, help us to smash it by providing a detailed and welcomed `feedback `_. Do not contact contributors directly about support or help with technical issues. diff --git a/currency_rate_update_boi/i18n/it.po b/currency_rate_update_boi/i18n/it.po index 6e33e99e23e3..42e50cc56391 100644 --- a/currency_rate_update_boi/i18n/it.po +++ b/currency_rate_update_boi/i18n/it.po @@ -6,15 +6,15 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2021-05-31 19:48+0000\n" -"Last-Translator: Sergio Corato \n" +"PO-Revision-Date: 2023-07-24 09:10+0000\n" +"Last-Translator: mymage \n" "Language-Team: none\n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.3.2\n" +"X-Generator: Weblate 4.17\n" #. module: currency_rate_update_boi #: model:ir.model.fields.selection,name:currency_rate_update_boi.selection__res_currency_rate_provider__service__boi @@ -29,17 +29,17 @@ msgstr "Provider Cambi Valuta" #. module: currency_rate_update_boi #: model:ir.model.fields,field_description:currency_rate_update_boi.field_res_currency_rate_provider__display_name msgid "Display Name" -msgstr "" +msgstr "Nome visualizzato" #. module: currency_rate_update_boi #: model:ir.model.fields,field_description:currency_rate_update_boi.field_res_currency_rate_provider__id msgid "ID" -msgstr "" +msgstr "ID" #. module: currency_rate_update_boi #: model:ir.model.fields,field_description:currency_rate_update_boi.field_res_currency_rate_provider____last_update msgid "Last Modified on" -msgstr "" +msgstr "Ultima modifica il" #. module: currency_rate_update_boi #: model:ir.model.fields,field_description:currency_rate_update_boi.field_res_currency_rate_provider__service diff --git a/currency_rate_update_boi/static/description/index.html b/currency_rate_update_boi/static/description/index.html index 30af1f8ef33b..5be1daf5190a 100644 --- a/currency_rate_update_boi/static/description/index.html +++ b/currency_rate_update_boi/static/description/index.html @@ -1,20 +1,20 @@ - + - + Currency Rate Update: Banca d'Italia