Skip to content

Commit 43d74a8

Browse files
committed
[MIG] l10n_it_amount_to_text: Migration to 18.0
1 parent 4a088d0 commit 43d74a8

File tree

6 files changed

+53
-52
lines changed

6 files changed

+53
-52
lines changed

l10n_it_amount_to_text/README.rst

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ ITA - Localizzazione valute per amount_to_text
1717
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1818
:alt: License: AGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github
20-
:target: https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_amount_to_text
20+
:target: https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_amount_to_text
2121
:alt: OCA/l10n-italy
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_amount_to_text
23+
:target: https://translation.odoo-community.org/projects/l10n-italy-18-0/l10n-italy-18-0-l10n_it_amount_to_text
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&target_branch=16.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&target_branch=18.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -36,8 +36,9 @@ impostazioni utente/partner, con alcune limitazioni.
3636

3737
Esempio: 45,75 €
3838

39-
- Lingua utente "Inglese" → Forty-Five Euros and Seventy-Five Cents
40-
- Lingua utente "Italiano" → Quarantacinque Euros e Settantacinque Cents
39+
- Lingua utente "Inglese" → Forty-Five Euros and Seventy-Five Cents
40+
- Lingua utente "Italiano" → Quarantacinque Euros e Settantacinque
41+
Cents
4142

4243
L'unità/sottounità di valuta non viene tradotta e non viene gestita la
4344
forma singolare. Inoltre tutte le parole possiedono l'iniziale
@@ -51,8 +52,8 @@ EUR, USD, GBP e CNY.
5152

5253
Esempio: 1,01 €
5354

54-
- La parte intera diventa "un euro", non "uno euro"
55-
- La parte decimale diventa "un centesimo", non "uno centesimi"
55+
- La parte intera diventa "un euro", non "uno euro"
56+
- La parte decimale diventa "un centesimo", non "uno centesimi"
5657

5758
**English**
5859

@@ -62,8 +63,8 @@ with some limitations.
6263

6364
Example: 45,75 €
6465

65-
- User Language 'English' -> Forty-Five Euros and Seventy-Five Cents
66-
- User Language 'Italian' -> Quaranta Euros e Settantacinque Cents
66+
- User Language 'English' -> Forty-Five Euros and Seventy-Five Cents
67+
- User Language 'Italian' -> Quaranta Euros e Settantacinque Cents
6768

6869
Currency unit/subunit is not translated and singular form is not
6970
handled. Moreover all words are capitalized, which is incorrect in
@@ -77,8 +78,8 @@ handled as well.
7778

7879
Example: 1,01 €
7980

80-
- Integer part becomes "un euro", not "uno euro"
81-
- Decimal part becomes "un centesimo", not "uno centesimi"
81+
- Integer part becomes "un euro", not "uno euro"
82+
- Decimal part becomes "un centesimo", not "uno centesimi"
8283

8384
**Table of contents**
8485

@@ -111,11 +112,11 @@ questo codice ai report:
111112

112113
<t t-foreach="docs" t-as="o">
113114
<t t-set="currency" t-value="o.currency_id"/>
114-
# Language obtained from context
115+
<!-- Language obtained from context -->
115116
<t t-out="currency.with_context(lang='it_IT').amount_to_text(45.75)"/>
116117

117-
# Language obtained from user/partner settings.
118-
# If not it_IT, Odoo core amount_to_text will be used.
118+
<!-- Language obtained from user/partner settings.
119+
If not it_IT, Odoo core amount_to_text will be used. -->
119120
<t t-out="currency.amount_to_text(45.75)"/>
120121
</t>
121122

@@ -130,11 +131,11 @@ reports:
130131

131132
<t t-foreach="docs" t-as="o">
132133
<t t-set="currency" t-value="o.currency_id"/>
133-
# Language obtained from context
134+
<!-- Language obtained from context -->
134135
<t t-out="currency.with_context(lang='it_IT').amount_to_text(45.75)"/>
135136

136-
# Language obtained from user/partner settings.
137-
# If not it_IT, Odoo core amount_to_text will be used.
137+
<!-- Language obtained from user/partner settings.
138+
If not it_IT, Odoo core amount_to_text will be used. -->
138139
<t t-out="currency.amount_to_text(45.75)"/>
139140
</t>
140141

@@ -144,7 +145,7 @@ Bug Tracker
144145
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/issues>`_.
145146
In case of trouble, please check there if your issue has already been reported.
146147
If you spotted it first, help us to smash it by providing a detailed and welcomed
147-
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_amount_to_text%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
148+
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_amount_to_text%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
148149

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

@@ -160,9 +161,10 @@ Authors
160161
Contributors
161162
------------
162163

163-
- Saran Lim. <[email protected]>
164-
- Pimolnat Suntian <[email protected]>
165-
- Sergio Zanchetta <https://github.com/primes2h>
164+
- Saran Lim. <[email protected]>
165+
- Pimolnat Suntian <[email protected]>
166+
- Sergio Zanchetta
167+
<`https://github.com/primes2h <https://github.com/primes2h>`__>
166168

167169
Maintainers
168170
-----------
@@ -177,6 +179,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
177179
mission is to support the collaborative development of Odoo features and
178180
promote its widespread use.
179181

180-
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_amount_to_text>`_ project on GitHub.
182+
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_amount_to_text>`_ project on GitHub.
181183

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

l10n_it_amount_to_text/__manifest__.py

Lines changed: 1 addition & 1 deletion
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": "16.0.1.0.0",
7+
"version": "18.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/models/res_currency.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,13 @@ def _num2words(number, lang):
3535
formatted_amount, to="currency", lang=lang.iso_code, currency=self.name
3636
)
3737
except NotImplementedError:
38-
amount_words = tools.ustr("{amt_value} {amt_word}").format(
39-
amt_value=_num2words(integer_value, lang=lang.iso_code),
40-
amt_word=self.currency_unit_label.lower(),
41-
)
38+
num_words = _num2words(integer_value, lang=lang.iso_code)
39+
currency_label = self.currency_unit_label.lower()
40+
amount_words = f"{num_words} {currency_label}"
41+
4242
if not self.is_zero(amount - integer_value):
43-
amount_words += (
44-
" "
45-
+ "e"
46-
+ tools.ustr(" {amt_value} {amt_word}").format(
47-
amt_value=_num2words(fractional_value, lang=lang.iso_code),
48-
amt_word=self.currency_subunit_label.lower(),
49-
)
50-
)
43+
fractional_words = _num2words(fractional_value, lang=lang.iso_code)
44+
subunit_label = self.currency_subunit_label.lower()
45+
amount_words += f" e {fractional_words} {subunit_label}"
46+
5147
return amount_words

l10n_it_amount_to_text/readme/USAGE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ questo codice ai report:
88

99
<t t-foreach="docs" t-as="o">
1010
<t t-set="currency" t-value="o.currency_id"/>
11-
# Language obtained from context
11+
<!-- Language obtained from context -->
1212
<t t-out="currency.with_context(lang='it_IT').amount_to_text(45.75)"/>
1313

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

@@ -25,10 +25,10 @@ reports:
2525

2626
<t t-foreach="docs" t-as="o">
2727
<t t-set="currency" t-value="o.currency_id"/>
28-
# Language obtained from context
28+
<!-- Language obtained from context -->
2929
<t t-out="currency.with_context(lang='it_IT').amount_to_text(45.75)"/>
3030

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

l10n_it_amount_to_text/static/description/index.html

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -369,15 +369,16 @@ <h1 class="title">ITA - Localizzazione valute per amount_to_text</h1>
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370370
!! source digest: sha256:71bc6284df98f6a3d8ca197c6beb24f1d90dcb5e677e78555dbeda59500686d3
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_amount_to_text"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_amount_to_text"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_amount_to_text"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-italy-18-0/l10n-italy-18-0-l10n_it_amount_to_text"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373373
<p><strong>Italiano</strong></p>
374374
<p>Il core di Odoo fornisce <tt class="docutils literal">amount_to_text</tt>, il quale converte importi
375375
numerici in testo ottenendo la lingua dal contesto fornito o dalle
376376
impostazioni utente/partner, con alcune limitazioni.</p>
377377
<p>Esempio: 45,75 €</p>
378378
<ul class="simple">
379379
<li>Lingua utente “Inglese” → Forty-Five Euros and Seventy-Five Cents</li>
380-
<li>Lingua utente “Italiano” → Quarantacinque Euros e Settantacinque Cents</li>
380+
<li>Lingua utente “Italiano” → Quarantacinque Euros e Settantacinque
381+
Cents</li>
381382
</ul>
382383
<p>L’unità/sottounità di valuta non viene tradotta e non viene gestita la
383384
forma singolare. Inoltre tutte le parole possiedono l’iniziale
@@ -443,11 +444,11 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
443444
<pre class="literal-block">
444445
&lt;t t-foreach=&quot;docs&quot; t-as=&quot;o&quot;&gt;
445446
&lt;t t-set=&quot;currency&quot; t-value=&quot;o.currency_id&quot;/&gt;
446-
# Language obtained from context
447+
&lt;!-- Language obtained from context --&gt;
447448
&lt;t t-out=&quot;currency.with_context(lang='it_IT').amount_to_text(45.75)&quot;/&gt;
448449

449-
# Language obtained from user/partner settings.
450-
# If not it_IT, Odoo core amount_to_text will be used.
450+
&lt;!-- Language obtained from user/partner settings.
451+
If not it_IT, Odoo core amount_to_text will be used. --&gt;
451452
&lt;t t-out=&quot;currency.amount_to_text(45.75)&quot;/&gt;
452453
&lt;/t&gt;
453454
</pre>
@@ -458,11 +459,11 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
458459
<pre class="literal-block">
459460
&lt;t t-foreach=&quot;docs&quot; t-as=&quot;o&quot;&gt;
460461
&lt;t t-set=&quot;currency&quot; t-value=&quot;o.currency_id&quot;/&gt;
461-
# Language obtained from context
462+
&lt;!-- Language obtained from context --&gt;
462463
&lt;t t-out=&quot;currency.with_context(lang='it_IT').amount_to_text(45.75)&quot;/&gt;
463464

464-
# Language obtained from user/partner settings.
465-
# If not it_IT, Odoo core amount_to_text will be used.
465+
&lt;!-- Language obtained from user/partner settings.
466+
If not it_IT, Odoo core amount_to_text will be used. --&gt;
466467
&lt;t t-out=&quot;currency.amount_to_text(45.75)&quot;/&gt;
467468
&lt;/t&gt;
468469
</pre>
@@ -472,7 +473,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
472473
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-italy/issues">GitHub Issues</a>.
473474
In case of trouble, please check there if your issue has already been reported.
474475
If you spotted it first, help us to smash it by providing a detailed and welcomed
475-
<a class="reference external" href="https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_amount_to_text%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
476+
<a class="reference external" href="https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_amount_to_text%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
476477
<p>Do not contact contributors directly about support or help with technical issues.</p>
477478
</div>
478479
<div class="section" id="credits">
@@ -489,7 +490,8 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
489490
<ul class="simple">
490491
<li>Saran Lim. &lt;<a class="reference external" href="mailto:saranl&#64;ecosoft.co.th">saranl&#64;ecosoft.co.th</a>&gt;</li>
491492
<li>Pimolnat Suntian &lt;<a class="reference external" href="mailto:pimolnats&#64;ecosoft.co.th">pimolnats&#64;ecosoft.co.th</a>&gt;</li>
492-
<li>Sergio Zanchetta &lt;<a class="reference external" href="https://github.com/primes2h">https://github.com/primes2h</a>&gt;</li>
493+
<li>Sergio Zanchetta
494+
&lt;<a class="reference external" href="https://github.com/primes2h">https://github.com/primes2h</a>&gt;</li>
493495
</ul>
494496
</div>
495497
<div class="section" id="maintainers">
@@ -501,7 +503,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
501503
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
502504
mission is to support the collaborative development of Odoo features and
503505
promote its widespread use.</p>
504-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_amount_to_text">OCA/l10n-italy</a> project on GitHub.</p>
506+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_amount_to_text">OCA/l10n-italy</a> project on GitHub.</p>
505507
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
506508
</div>
507509
</div>

l10n_it_amount_to_text/tests/test_amount_to_text.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class TestAmountToText(TransactionCase):
1111
@classmethod
1212
def setUpClass(cls):
1313
super().setUpClass()
14+
cls.env(context=dict(cls.env.context, tracking_disable=True))
1415
cls.env["res.lang"]._activate_lang("it_IT")
1516

1617
def test_01_currency_it_amount_to_text(self):

0 commit comments

Comments
 (0)