From be035d9eb64d0576e030f41e3f860659127d4f0f Mon Sep 17 00:00:00 2001 From: Sergio Zanchetta Date: Wed, 29 Jan 2025 22:30:23 +0100 Subject: [PATCH] [MIG] l10n_it_amount_to_text: Migration to 16.0 --- l10n_it_amount_to_text/README.rst | 8 +++---- l10n_it_amount_to_text/__manifest__.py | 2 +- l10n_it_amount_to_text/readme/USAGE.md | 8 +++---- .../static/description/index.html | 8 +++---- .../tests/test_amount_to_text.py | 23 ++++++++----------- 5 files changed, 23 insertions(+), 26 deletions(-) diff --git a/l10n_it_amount_to_text/README.rst b/l10n_it_amount_to_text/README.rst index 58d5a398930..82108099a52 100644 --- a/l10n_it_amount_to_text/README.rst +++ b/l10n_it_amount_to_text/README.rst @@ -113,11 +113,11 @@ questo codice ai report: # Language obtained from context - + # Language obtained from user/partner settings. # If not it_IT, Odoo core amount_to_text will be used. - + **English** @@ -132,11 +132,11 @@ reports: # Language obtained from context - + # Language obtained from user/partner settings. # If not it_IT, Odoo core amount_to_text will be used. - + Bug Tracker diff --git a/l10n_it_amount_to_text/__manifest__.py b/l10n_it_amount_to_text/__manifest__.py index 93651f31c4f..9b159afe508 100644 --- a/l10n_it_amount_to_text/__manifest__.py +++ b/l10n_it_amount_to_text/__manifest__.py @@ -4,7 +4,7 @@ { "name": "ITA - Localizzazione valute per amount_to_text", - "version": "14.0.1.0.0", + "version": "16.0.1.0.0", "category": "Localization/Italy", "summary": "Localizza le valute in italiano per amount_to_text", "author": "Sergio Zanchetta - Associazione PNLug APS," diff --git a/l10n_it_amount_to_text/readme/USAGE.md b/l10n_it_amount_to_text/readme/USAGE.md index 18dc950911f..e8b7fe9a819 100644 --- a/l10n_it_amount_to_text/readme/USAGE.md +++ b/l10n_it_amount_to_text/readme/USAGE.md @@ -9,11 +9,11 @@ questo codice ai report: # Language obtained from context - + # Language obtained from user/partner settings. # If not it_IT, Odoo core amount_to_text will be used. - + **English** @@ -26,9 +26,9 @@ reports: # Language obtained from context - + # Language obtained from user/partner settings. # If not it_IT, Odoo core amount_to_text will be used. - + diff --git a/l10n_it_amount_to_text/static/description/index.html b/l10n_it_amount_to_text/static/description/index.html index ca25f185b06..50edcd84e2b 100644 --- a/l10n_it_amount_to_text/static/description/index.html +++ b/l10n_it_amount_to_text/static/description/index.html @@ -445,11 +445,11 @@

Usage

<t t-foreach="docs" t-as="o"> <t t-set="currency" t-value="o.currency_id"/> # Language obtained from context - <t t-esc="currency.with_context({'lang': 'it_IT'}).amount_to_text(45.75)"/> + <t t-out="currency.with_context(lang='it_IT').amount_to_text(45.75)"/> # Language obtained from user/partner settings. # If not it_IT, Odoo core amount_to_text will be used. - <t t-esc="currency.amount_to_text(45.75)"/> + <t t-out="currency.amount_to_text(45.75)"/> </t>

English

@@ -460,11 +460,11 @@

Usage

<t t-foreach="docs" t-as="o"> <t t-set="currency" t-value="o.currency_id"/> # Language obtained from context - <t t-esc="currency.with_context({'lang': 'it_IT'}).amount_to_text(45.75)"/> + <t t-out="currency.with_context(lang='it_IT').amount_to_text(45.75)"/> # Language obtained from user/partner settings. # If not it_IT, Odoo core amount_to_text will be used. - <t t-esc="currency.amount_to_text(45.75)"/> + <t t-out="currency.amount_to_text(45.75)"/> </t> diff --git a/l10n_it_amount_to_text/tests/test_amount_to_text.py b/l10n_it_amount_to_text/tests/test_amount_to_text.py index 1ec92ac8576..79f3e431a22 100644 --- a/l10n_it_amount_to_text/tests/test_amount_to_text.py +++ b/l10n_it_amount_to_text/tests/test_amount_to_text.py @@ -4,13 +4,14 @@ from num2words import num2words -from odoo.tests.common import SavepointCase +from odoo.tests.common import TransactionCase -class TestAmountToText(SavepointCase): - def setUp(self): - super(TestAmountToText, self).setUp() - self.env["res.lang"]._activate_lang("it_IT") +class TestAmountToText(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env["res.lang"]._activate_lang("it_IT") def test_01_currency_it_amount_to_text(self): """check that amount_to_text correctly converts text @@ -21,7 +22,7 @@ def test_01_currency_it_amount_to_text(self): self.assertEqual( amount_text_en, "One Thousand And Fifty Euros and Seventy-Five Cents" ) - amount_text_it = currency.with_context({"lang": "it_IT"}).amount_to_text(amount) + amount_text_it = currency.with_context(lang="it_IT").amount_to_text(amount) num2words(amount, to="currency", lang="it") self.assertEqual( amount_text_it, "millecinquanta euro e settantacinque centesimi" @@ -32,9 +33,7 @@ def test_02_currency_unit_it_amount_to_text(self): unit/subunit to italian language singular form""" currency = self.env.ref("base.EUR") amount = 1.01 - amount_text_it_unit = currency.with_context({"lang": "it_IT"}).amount_to_text( - amount - ) + amount_text_it_unit = currency.with_context(lang="it_IT").amount_to_text(amount) self.assertEqual(amount_text_it_unit, "un euro e un centesimo") def test_03_currency_usd_amount_to_text(self): @@ -52,7 +51,7 @@ def test_04_currency_zero_fractional_value_it_amount_to_text(self): currency = self.env.ref("base.EUR") amount = 3.00 amount_text_it_zero_fractional = currency.with_context( - {"lang": "it_IT"} + lang="it_IT" ).amount_to_text(amount) self.assertEqual(amount_text_it_zero_fractional, "tre euro e zero centesimi") @@ -61,7 +60,5 @@ def test_05_currency_aed_amount_to_text(self): using a currency different from EUR/USD/GBP/CNY""" currency = self.env.ref("base.AED") amount = 1050.75 - amount_text_aed = currency.with_context({"lang": "it_IT"}).amount_to_text( - amount - ) + amount_text_aed = currency.with_context(lang="it_IT").amount_to_text(amount) self.assertEqual(amount_text_aed, "millecinquanta dirham e settantacinque fils")