Skip to content

Commit 6340163

Browse files
primes2hSirAionTech
authored andcommitted
[ADD] l10n_it_account_stamp: migration scripts
1 parent 2b02d23 commit 6340163

8 files changed

Lines changed: 208 additions & 30 deletions

File tree

l10n_it_account_stamp/README.rst

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fatture e nelle ricevute.
3535

3636
**English**
3737

38-
This module adds Italian Tax Stamp support in invoices and receipts.
38+
This module adds Italian Stamp Duty support in invoices and receipts.
3939

4040
**Table of contents**
4141

@@ -58,7 +58,7 @@ necessario abilitare le funzioni complete per la contabilità:
5858
Modalità automatica:
5959

6060
- andare sul prodotto "Imposta di bollo 2 euro" e configurare "Imposte
61-
marca da bollo" (Imposte in esenzione).
61+
per bollo" (Imposte in esenzione).
6262
- per ciascuna fattura o ricevuta, l'applicabilità dell'imposta di
6363
bollo verrà calcolata in modo automatico in base alla somma degli
6464
imponibili relativi alle imposte selezionate.
@@ -77,7 +77,7 @@ generalmente ricavo="Debiti per bolli" e costo="Valori bollati".
7777

7878
**English**
7979

80-
In order to change Tax Stamp 2 euro product settings, enable full
80+
In order to change 'Stamp duty 2 euro' product settings, enable full
8181
accounting features:
8282

8383
1. Settings -> Users & Companies -> Groups
@@ -86,17 +86,17 @@ accounting features:
8686

8787
Automatic mode:
8888

89-
- Go to 'Tax Stamp 2 euro' product and configure 'Stamp taxes'
89+
- Go to 'Stamp duty 2 euro' product and configure 'Stamp taxes'
9090
(exemption taxes).
9191
- For each invoice or receipt, the base amount for each selected tax
9292
will be added up and used to determine the application of the account
9393
stamp.
9494

9595
Manual mode:
9696

97-
- Go to 'Tax Stamp 2 euro' product and deselect 'Auto-compute'
97+
- Go to 'Stamp duty 2 euro' product and deselect 'Auto-compute'
9898
checkbox.
99-
- For each invoice or receipt, manually enable 'Tax Stamp' checkbox.
99+
- For each invoice or receipt, manually enable 'Stamp Duty' checkbox.
100100

101101
Also set income/expense accounts, typically income = 'Debiti per bolli'
102102
and expense = 'Valori bollati'.
@@ -115,12 +115,25 @@ verrà addebitata al cliente.
115115

116116
**English**
117117

118-
In invoice or receipt form, when applicable, click 'Add tax stamp line'
119-
button to add tax stamp as invoice line, thus charging customer.
118+
In invoice or receipt form, when applicable, click 'Add stamp duty line'
119+
button to add stamp duty as invoice line, thus charging customer.
120120

121-
Otherwise, tax stamp will be anyway accounted, without charging
121+
Otherwise, stamp duty will be anyway accounted, without charging
122122
customer.
123123

124+
Known issues / Roadmap
125+
======================
126+
127+
\*\* Italiano \*\*
128+
129+
Sono stati aggiunti gli script di migrazione, da provare quando saranno
130+
rilasciati quelli relativi ad ``account``.
131+
132+
\*\* English \*\*
133+
134+
Migration scripts have been added, to be tested when ``account`` related
135+
ones will be released.
136+
124137
Bug Tracker
125138
===========
126139

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version='1.0' encoding='utf-8' ?>
2+
<odoo>
3+
<record id="l10n_it_account_stamp_2_euro" model="product.product">
4+
<field name="name">Stamp duty 2 euro</field>
5+
</record>
6+
<record id="base.main_company" model="res.company">
7+
<field
8+
name="l10n_it_account_stamp_stamp_duty_product_id"
9+
ref="l10n_it_account_stamp.l10n_it_account_stamp_2_euro"
10+
/>
11+
</record>
12+
</odoo>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2024 Sergio Zanchetta
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from openupgradelib import openupgrade
5+
6+
7+
@openupgrade.migrate()
8+
def migrate(env, version):
9+
openupgrade.load_data(
10+
env.cr, "l10n_it_account_stamp", "18.0.1.0.0/noupdate_changes.xml"
11+
)
12+
openupgrade.delete_record_translations(
13+
env.cr, "l10n_it_account_stamp", ["l10n_it_account_stamp_2_euro"]
14+
)
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Copyright 2024 Sergio Zanchetta
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from openupgradelib import openupgrade
5+
6+
7+
def _rename_fields(env):
8+
openupgrade.rename_fields(
9+
env,
10+
[
11+
(
12+
"account.move",
13+
"account_move",
14+
"l10n_it_account_stamp_is_tax_stamp_applied",
15+
"l10n_it_account_stamp_is_stamp_duty_applied",
16+
),
17+
(
18+
"account.move",
19+
"account_move",
20+
"l10n_it_account_stamp_is_tax_stamp_present",
21+
"l10n_it_account_stamp_is_stamp_duty_present",
22+
),
23+
(
24+
"account.move",
25+
"account_move",
26+
"l10n_it_account_stamp_auto_compute_tax_stamp",
27+
"l10n_it_account_stamp_auto_compute_stamp_duty",
28+
),
29+
(
30+
"account.move",
31+
"account_move",
32+
"l10n_it_account_stamp_manually_apply_tax_stamp",
33+
"l10n_it_account_stamp_manually_apply_stamp_duty",
34+
),
35+
(
36+
"res.company",
37+
"res_company",
38+
"l10n_it_account_stamp_tax_stamp_product_id",
39+
"l10n_it_account_stamp_stamp_duty_product_id",
40+
),
41+
(
42+
"res.config.settings",
43+
"res_config_settings",
44+
"l10n_it_account_stamp_tax_stamp_product_id",
45+
"l10n_it_account_stamp_stamp_duty_product_id",
46+
),
47+
(
48+
"product.template",
49+
"product_template",
50+
"l10n_it_account_stamp_tax_stamp_apply_tax_ids",
51+
"l10n_it_account_stamp_stamp_duty_apply_tax_ids",
52+
),
53+
],
54+
)
55+
56+
57+
@openupgrade.migrate()
58+
def migrate(env, version):
59+
_rename_fields(env)
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Copyright 2024 Sergio Zanchetta
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from openupgradelib import openupgrade
5+
6+
7+
def _rename_fields(env):
8+
openupgrade.rename_fields(
9+
env,
10+
[
11+
(
12+
"account.move",
13+
"account_move",
14+
"l10n_it_account_stamp_is_tax_stamp_applied",
15+
"l10n_it_account_stamp_is_stamp_duty_applied",
16+
),
17+
(
18+
"account.move",
19+
"account_move",
20+
"l10n_it_account_stamp_is_tax_stamp_present",
21+
"l10n_it_account_stamp_is_stamp_duty_present",
22+
),
23+
(
24+
"account.move",
25+
"account_move",
26+
"l10n_it_account_stamp_auto_compute_tax_stamp",
27+
"l10n_it_account_stamp_auto_compute_stamp_duty",
28+
),
29+
(
30+
"account.move",
31+
"account_move",
32+
"l10n_it_account_stamp_manually_apply_tax_stamp",
33+
"l10n_it_account_stamp_manually_apply_stamp_duty",
34+
),
35+
(
36+
"res.company",
37+
"res_company",
38+
"l10n_it_account_stamp_tax_stamp_product_id",
39+
"l10n_it_account_stamp_stamp_duty_product_id",
40+
),
41+
(
42+
"res.config.settings",
43+
"res_config_settings",
44+
"l10n_it_account_stamp_tax_stamp_product_id",
45+
"l10n_it_account_stamp_stamp_duty_product_id",
46+
),
47+
(
48+
"product.template",
49+
"product_template",
50+
"l10n_it_account_stamp_tax_stamp_apply_tax_ids",
51+
"l10n_it_account_stamp_stamp_duty_apply_tax_ids",
52+
),
53+
],
54+
)
55+
56+
57+
@openupgrade.migrate()
58+
def migrate(env, version):
59+
_rename_fields(env)

l10n_it_account_stamp/models/account_move.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,12 @@ def _post(self, soft=True):
192192
lang=inv.partner_id.lang
193193
).l10n_it_account_stamp_stamp_duty_product_id
194194
if not stamp_product_id:
195-
raise UserError(_("Missing stamp duty product in company settings!"))
196-
income_vals, expense_vals = inv._build_stamp_duty_lines(stamp_product_id)
195+
raise UserError(
196+
_("Missing stamp duty product in company settings!")
197+
)
198+
income_vals, expense_vals = inv._build_stamp_duty_lines(
199+
stamp_product_id
200+
)
197201
income_vals["move_id"] = inv.id
198202
expense_vals["move_id"] = inv.id
199203
line_model.with_context(check_move_validity=False).create(income_vals)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
** Italiano **
2+
3+
Sono stati aggiunti gli script di migrazione, da provare quando saranno rilasciati quelli relativi ad `account`.
4+
5+
** English **
6+
7+
Migration scripts have been added, to be tested when `account` related ones will be released.

l10n_it_account_stamp/static/description/index.html

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -374,17 +374,18 @@ <h1 class="title">ITA - Imposta di bollo</h1>
374374
<p>Questo modulo aggiunge il supporto all’imposta di bollo italiana nelle
375375
fatture e nelle ricevute.</p>
376376
<p><strong>English</strong></p>
377-
<p>This module adds Italian Tax Stamp support in invoices and receipts.</p>
377+
<p>This module adds Italian Stamp Duty support in invoices and receipts.</p>
378378
<p><strong>Table of contents</strong></p>
379379
<div class="contents local topic" id="contents">
380380
<ul class="simple">
381381
<li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a></li>
382382
<li><a class="reference internal" href="#usage" id="toc-entry-2">Usage</a></li>
383-
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
384-
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
385-
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
386-
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
387-
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
383+
<li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-3">Known issues / Roadmap</a></li>
384+
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-4">Bug Tracker</a></li>
385+
<li><a class="reference internal" href="#credits" id="toc-entry-5">Credits</a><ul>
386+
<li><a class="reference internal" href="#authors" id="toc-entry-6">Authors</a></li>
387+
<li><a class="reference internal" href="#contributors" id="toc-entry-7">Contributors</a></li>
388+
<li><a class="reference internal" href="#maintainers" id="toc-entry-8">Maintainers</a></li>
388389
</ul>
389390
</li>
390391
</ul>
@@ -403,7 +404,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
403404
<p>Modalità automatica:</p>
404405
<ul class="simple">
405406
<li>andare sul prodotto “Imposta di bollo 2 euro” e configurare “Imposte
406-
marca da bollo” (Imposte in esenzione).</li>
407+
per bollo” (Imposte in esenzione).</li>
407408
<li>per ciascuna fattura o ricevuta, l’applicabilità dell’imposta di
408409
bollo verrà calcolata in modo automatico in base alla somma degli
409410
imponibili relativi alle imposte selezionate.</li>
@@ -420,7 +421,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
420421
<p>Impostare i conti di ricavo/costo nella scheda “Contabilità”,
421422
generalmente ricavo=”Debiti per bolli” e costo=”Valori bollati”.</p>
422423
<p><strong>English</strong></p>
423-
<p>In order to change Tax Stamp 2 euro product settings, enable full
424+
<p>In order to change Stamp duty 2 euro product settings, enable full
424425
accounting features:</p>
425426
<ol class="arabic simple">
426427
<li>Settings -&gt; Users &amp; Companies -&gt; Groups</li>
@@ -429,17 +430,17 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
429430
</ol>
430431
<p>Automatic mode:</p>
431432
<ul class="simple">
432-
<li>Go to ‘Tax Stamp 2 euro’ product and configure ‘Stamp taxes’
433+
<li>Go to ‘Stamp duty 2 euro’ product and configure ‘Stamp taxes’
433434
(exemption taxes).</li>
434435
<li>For each invoice or receipt, the base amount for each selected tax
435436
will be added up and used to determine the application of the account
436437
stamp.</li>
437438
</ul>
438439
<p>Manual mode:</p>
439440
<ul class="simple">
440-
<li>Go to ‘Tax Stamp 2 euro’ product and deselect ‘Auto-compute’
441+
<li>Go to ‘Stamp duty 2 euro’ product and deselect ‘Auto-compute’
441442
checkbox.</li>
442-
<li>For each invoice or receipt, manually enable ‘Tax Stamp’ checkbox.</li>
443+
<li>For each invoice or receipt, manually enable ‘Stamp Duty’ checkbox.</li>
443444
</ul>
444445
<p>Also set income/expense accounts, typically income = ‘Debiti per bolli’
445446
and expense = ‘Valori bollati’.</p>
@@ -453,31 +454,40 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
453454
<p>In caso contrario, l’imposta di bollo verrà comunque considerata ma non
454455
verrà addebitata al cliente.</p>
455456
<p><strong>English</strong></p>
456-
<p>In invoice or receipt form, when applicable, click ‘Add tax stamp line’
457-
button to add tax stamp as invoice line, thus charging customer.</p>
458-
<p>Otherwise, tax stamp will be anyway accounted, without charging
457+
<p>In invoice or receipt form, when applicable, click ‘Add stamp duty line’
458+
button to add stamp duty as invoice line, thus charging customer.</p>
459+
<p>Otherwise, stamp duty will be anyway accounted, without charging
459460
customer.</p>
460461
</div>
462+
<div class="section" id="known-issues-roadmap">
463+
<h1><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h1>
464+
<p>** Italiano **</p>
465+
<p>Sono stati aggiunti gli script di migrazione, da provare quando saranno
466+
rilasciati quelli relativi ad <tt class="docutils literal">account</tt>.</p>
467+
<p>** English **</p>
468+
<p>Migration scripts have been added, to be tested when <tt class="docutils literal">account</tt> related
469+
ones will be released.</p>
470+
</div>
461471
<div class="section" id="bug-tracker">
462-
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
472+
<h1><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h1>
463473
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-italy/issues">GitHub Issues</a>.
464474
In case of trouble, please check there if your issue has already been reported.
465475
If you spotted it first, help us to smash it by providing a detailed and welcomed
466476
<a class="reference external" href="https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_account_stamp%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
467477
<p>Do not contact contributors directly about support or help with technical issues.</p>
468478
</div>
469479
<div class="section" id="credits">
470-
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
480+
<h1><a class="toc-backref" href="#toc-entry-5">Credits</a></h1>
471481
<div class="section" id="authors">
472-
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
482+
<h2><a class="toc-backref" href="#toc-entry-6">Authors</a></h2>
473483
<ul class="simple">
474484
<li>Ermanno Gnan</li>
475485
<li>Sergio Corato</li>
476486
<li>Enrico Ganzaroli</li>
477487
</ul>
478488
</div>
479489
<div class="section" id="contributors">
480-
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
490+
<h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
481491
<ul class="simple">
482492
<li>Lorenzo Battistini &lt;<a class="reference external" href="https://github.com/eLBati">https://github.com/eLBati</a>&gt;</li>
483493
<li>Sergio Corato</li>
@@ -494,7 +504,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
494504
</ul>
495505
</div>
496506
<div class="section" id="maintainers">
497-
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
507+
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
498508
<p>This module is maintained by the OCA.</p>
499509
<a class="reference external image-reference" href="https://odoo-community.org">
500510
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />

0 commit comments

Comments
 (0)