Skip to content

Commit be035d9

Browse files
committed
[MIG] l10n_it_amount_to_text: Migration to 16.0
1 parent e5e6226 commit be035d9

File tree

5 files changed

+23
-26
lines changed

5 files changed

+23
-26
lines changed

l10n_it_amount_to_text/README.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ questo codice ai report:
113113
<t t-foreach="docs" t-as="o">
114114
<t t-set="currency" t-value="o.currency_id"/>
115115
# Language obtained from context
116-
<t t-esc="currency.with_context({'lang': 'it_IT'}).amount_to_text(45.75)"/>
116+
<t t-out="currency.with_context(lang='it_IT').amount_to_text(45.75)"/>
117117

118118
# Language obtained from user/partner settings.
119119
# If not it_IT, Odoo core amount_to_text will be used.
120-
<t t-esc="currency.amount_to_text(45.75)"/>
120+
<t t-out="currency.amount_to_text(45.75)"/>
121121
</t>
122122

123123
**English**
@@ -132,11 +132,11 @@ reports:
132132
<t t-foreach="docs" t-as="o">
133133
<t t-set="currency" t-value="o.currency_id"/>
134134
# Language obtained from context
135-
<t t-esc="currency.with_context({'lang': 'it_IT'}).amount_to_text(45.75)"/>
135+
<t t-out="currency.with_context(lang='it_IT').amount_to_text(45.75)"/>
136136

137137
# Language obtained from user/partner settings.
138138
# If not it_IT, Odoo core amount_to_text will be used.
139-
<t t-esc="currency.amount_to_text(45.75)"/>
139+
<t t-out="currency.amount_to_text(45.75)"/>
140140
</t>
141141

142142
Bug Tracker

l10n_it_amount_to_text/__manifest__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
{
66
"name": "ITA - Localizzazione valute per amount_to_text",
7-
"version": "14.0.1.0.0",
7+
"version": "16.0.1.0.0",
88
"category": "Localization/Italy",
99
"summary": "Localizza le valute in italiano per amount_to_text",
1010
"author": "Sergio Zanchetta - Associazione PNLug APS,"

l10n_it_amount_to_text/readme/USAGE.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ questo codice ai report:
99
<t t-foreach="docs" t-as="o">
1010
<t t-set="currency" t-value="o.currency_id"/>
1111
# Language obtained from context
12-
<t t-esc="currency.with_context({'lang': 'it_IT'}).amount_to_text(45.75)"/>
12+
<t t-out="currency.with_context(lang='it_IT').amount_to_text(45.75)"/>
1313

1414
# Language obtained from user/partner settings.
1515
# If not it_IT, Odoo core amount_to_text will be used.
16-
<t t-esc="currency.amount_to_text(45.75)"/>
16+
<t t-out="currency.amount_to_text(45.75)"/>
1717
</t>
1818

1919
**English**
@@ -26,9 +26,9 @@ reports:
2626
<t t-foreach="docs" t-as="o">
2727
<t t-set="currency" t-value="o.currency_id"/>
2828
# Language obtained from context
29-
<t t-esc="currency.with_context({'lang': 'it_IT'}).amount_to_text(45.75)"/>
29+
<t t-out="currency.with_context(lang='it_IT').amount_to_text(45.75)"/>
3030

3131
# Language obtained from user/partner settings.
3232
# If not it_IT, Odoo core amount_to_text will be used.
33-
<t t-esc="currency.amount_to_text(45.75)"/>
33+
<t t-out="currency.amount_to_text(45.75)"/>
3434
</t>

l10n_it_amount_to_text/static/description/index.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -445,11 +445,11 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
445445
&lt;t t-foreach=&quot;docs&quot; t-as=&quot;o&quot;&gt;
446446
&lt;t t-set=&quot;currency&quot; t-value=&quot;o.currency_id&quot;/&gt;
447447
# Language obtained from context
448-
&lt;t t-esc=&quot;currency.with_context({'lang': 'it_IT'}).amount_to_text(45.75)&quot;/&gt;
448+
&lt;t t-out=&quot;currency.with_context(lang='it_IT').amount_to_text(45.75)&quot;/&gt;
449449

450450
# Language obtained from user/partner settings.
451451
# If not it_IT, Odoo core amount_to_text will be used.
452-
&lt;t t-esc=&quot;currency.amount_to_text(45.75)&quot;/&gt;
452+
&lt;t t-out=&quot;currency.amount_to_text(45.75)&quot;/&gt;
453453
&lt;/t&gt;
454454
</pre>
455455
<p><strong>English</strong></p>
@@ -460,11 +460,11 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
460460
&lt;t t-foreach=&quot;docs&quot; t-as=&quot;o&quot;&gt;
461461
&lt;t t-set=&quot;currency&quot; t-value=&quot;o.currency_id&quot;/&gt;
462462
# Language obtained from context
463-
&lt;t t-esc=&quot;currency.with_context({'lang': 'it_IT'}).amount_to_text(45.75)&quot;/&gt;
463+
&lt;t t-out=&quot;currency.with_context(lang='it_IT').amount_to_text(45.75)&quot;/&gt;
464464

465465
# Language obtained from user/partner settings.
466466
# If not it_IT, Odoo core amount_to_text will be used.
467-
&lt;t t-esc=&quot;currency.amount_to_text(45.75)&quot;/&gt;
467+
&lt;t t-out=&quot;currency.amount_to_text(45.75)&quot;/&gt;
468468
&lt;/t&gt;
469469
</pre>
470470
</div>

l10n_it_amount_to_text/tests/test_amount_to_text.py

+10-13
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44

55
from num2words import num2words
66

7-
from odoo.tests.common import SavepointCase
7+
from odoo.tests.common import TransactionCase
88

99

10-
class TestAmountToText(SavepointCase):
11-
def setUp(self):
12-
super(TestAmountToText, self).setUp()
13-
self.env["res.lang"]._activate_lang("it_IT")
10+
class TestAmountToText(TransactionCase):
11+
@classmethod
12+
def setUpClass(cls):
13+
super().setUpClass()
14+
cls.env["res.lang"]._activate_lang("it_IT")
1415

1516
def test_01_currency_it_amount_to_text(self):
1617
"""check that amount_to_text correctly converts text
@@ -21,7 +22,7 @@ def test_01_currency_it_amount_to_text(self):
2122
self.assertEqual(
2223
amount_text_en, "One Thousand And Fifty Euros and Seventy-Five Cents"
2324
)
24-
amount_text_it = currency.with_context({"lang": "it_IT"}).amount_to_text(amount)
25+
amount_text_it = currency.with_context(lang="it_IT").amount_to_text(amount)
2526
num2words(amount, to="currency", lang="it")
2627
self.assertEqual(
2728
amount_text_it, "millecinquanta euro e settantacinque centesimi"
@@ -32,9 +33,7 @@ def test_02_currency_unit_it_amount_to_text(self):
3233
unit/subunit to italian language singular form"""
3334
currency = self.env.ref("base.EUR")
3435
amount = 1.01
35-
amount_text_it_unit = currency.with_context({"lang": "it_IT"}).amount_to_text(
36-
amount
37-
)
36+
amount_text_it_unit = currency.with_context(lang="it_IT").amount_to_text(amount)
3837
self.assertEqual(amount_text_it_unit, "un euro e un centesimo")
3938

4039
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):
5251
currency = self.env.ref("base.EUR")
5352
amount = 3.00
5453
amount_text_it_zero_fractional = currency.with_context(
55-
{"lang": "it_IT"}
54+
lang="it_IT"
5655
).amount_to_text(amount)
5756
self.assertEqual(amount_text_it_zero_fractional, "tre euro e zero centesimi")
5857

@@ -61,7 +60,5 @@ def test_05_currency_aed_amount_to_text(self):
6160
using a currency different from EUR/USD/GBP/CNY"""
6261
currency = self.env.ref("base.AED")
6362
amount = 1050.75
64-
amount_text_aed = currency.with_context({"lang": "it_IT"}).amount_to_text(
65-
amount
66-
)
63+
amount_text_aed = currency.with_context(lang="it_IT").amount_to_text(amount)
6764
self.assertEqual(amount_text_aed, "millecinquanta dirham e settantacinque fils")

0 commit comments

Comments
 (0)