Skip to content

Commit d82721e

Browse files
committed
[MIG] l10n_it_fiscal_document_type: Migration to 16.0
1 parent 16b7f9b commit d82721e

12 files changed

Lines changed: 44 additions & 67 deletions

File tree

l10n_it_fiscal_document_type/README.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ ITA - Tipi di documento fiscale per dichiarativi
1414
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1515
:alt: License: AGPL-3
1616
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github
17-
:target: https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_fiscal_document_type
17+
:target: https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_fiscal_document_type
1818
:alt: OCA/l10n-italy
1919
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20-
:target: https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_fiscal_document_type
20+
:target: https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_fiscal_document_type
2121
:alt: Translate me on Weblate
2222
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23-
:target: https://runbot.odoo-community.org/runbot/122/14.0
23+
:target: https://runbot.odoo-community.org/runbot/122/16.0
2424
:alt: Try me on Runbot
2525

2626
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -59,7 +59,7 @@ Bug Tracker
5959
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/issues>`_.
6060
In case of trouble, please check there if your issue has already been reported.
6161
If you spotted it first, help us smashing it by providing a detailed and welcomed
62-
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_fiscal_document_type%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
62+
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_fiscal_document_type%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
6363

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

@@ -79,6 +79,7 @@ Contributors
7979
* Gianmarco Conte <gconte@dinamicheaziendali.it>
8080
* Sergio Zanchetta <https://github.com/primes2h>
8181
* Alfredo Zamora <alfredo.zamora@agilebg.com>
82+
* Marco Colombo <marco.colombo@phi.technology>
8283

8384
Other credits
8485
~~~~~~~~~~~~~
@@ -100,6 +101,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
100101
mission is to support the collaborative development of Odoo features and
101102
promote its widespread use.
102103

103-
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_fiscal_document_type>`_ project on GitHub.
104+
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_fiscal_document_type>`_ project on GitHub.
104105

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

l10n_it_fiscal_document_type/__manifest__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
# Copyright 2018 Sergio Zanchetta (Associazione PNLUG - Gruppo Odoo)
33
# Copyright 2018 Lorenzo Battistini (https://github.com/eLBati)
44
# Copyright 2021 Andrea Cometa (https://www.apuliasoftware.it)
5+
# Copyright 2022 Marco Colombo (<marco.colombo@phi.technology>
56
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
67

78
{
89
"name": "ITA - Tipi di documento fiscale per dichiarativi",
9-
"version": "14.0.1.1.1",
10+
"version": "16.0.1.0.0",
1011
"category": "Localization/Italy",
1112
"author": "Link It srl, Odoo Community Association (OCA)",
1213
"website": "https://github.com/OCA/l10n-italy",

l10n_it_fiscal_document_type/migrations/13.0.1.0.0/post-migration.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

l10n_it_fiscal_document_type/models/account_move.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@ def _get_document_fiscal_type(
8484
readonly=False,
8585
)
8686

87-
def _reverse_move_vals(self, default_values, cancel=True):
88-
vals = super()._reverse_move_vals(default_values, cancel)
89-
# when reversing a move, fiscal_document_type_id should be recomputed, not copied
90-
if "fiscal_document_type_id" in vals:
91-
del vals["fiscal_document_type_id"]
92-
return vals
87+
def _reverse_moves(self, default_values_list=None, cancel=False):
88+
reverse_moves = super()._reverse_moves(
89+
default_values_list=default_values_list, cancel=cancel
90+
)
91+
reverse_moves.update({"fiscal_document_type_id": False})
92+
reverse_moves._compute_set_document_fiscal_type()
93+
return reverse_moves

l10n_it_fiscal_document_type/models/fiscal_document_type.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
class FiscalDocumentType(models.Model):
55
_name = "fiscal.document.type"
66
_description = "Fiscal document type"
7+
_rec_names_search = ["name", "code"]
78

8-
code = fields.Char(string="Code", size=5, required=True)
9-
name = fields.Char(string="Name", size=100, required=True)
9+
code = fields.Char(size=5, required=True)
10+
name = fields.Char(size=100, required=True)
1011
out_invoice = fields.Boolean(string="Customer Invoice")
1112
in_invoice = fields.Boolean(string="Vendor Bill")
1213
out_refund = fields.Boolean(string="Customer Credit Note")
1314
in_refund = fields.Boolean(string="Vendor Credit Note")
14-
priority = fields.Integer(string="Priority", default="3")
15+
priority = fields.Integer(default="3")
1516

1617
journal_ids = fields.Many2many(
1718
"account.journal",
@@ -27,9 +28,9 @@ class FiscalDocumentType(models.Model):
2728

2829
_order = "code, priority asc"
2930

30-
@api.model
31-
def create(self, vals):
32-
res = super(FiscalDocumentType, self).create(vals)
31+
@api.model_create_multi
32+
def create(self, vals_list):
33+
res = super(FiscalDocumentType, self).create(vals_list)
3334
res.journal_ids.check_doc_type_relation()
3435
return res
3536

@@ -44,16 +45,3 @@ def name_get(self):
4445
for doc_type in self:
4546
res.append((doc_type.id, "[%s] %s" % (doc_type.code, doc_type.name)))
4647
return res
47-
48-
@api.model
49-
def name_search(self, name="", args=None, operator="ilike", limit=100):
50-
if not args:
51-
args = []
52-
if name:
53-
records = self.search(
54-
["|", ("name", operator, name), ("code", operator, name)] + args,
55-
limit=limit,
56-
)
57-
else:
58-
records = self.search(args, limit=limit)
59-
return records.name_get()

l10n_it_fiscal_document_type/models/journal.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def check_doc_type_relation(self):
1313
if len(docs) > 1:
1414
raise UserError(
1515
_(
16-
"Journal %s can be linked to only 1 fiscal document "
17-
"type (found in %s)"
16+
"Journal %(name)s can be linked to only 1 fiscal document "
17+
"type (found in %(spec)s)"
1818
)
19-
% (journal.name, ", ".join([d.code for d in docs]))
19+
% {"name": journal.name, "spec": ", ".join([d.code for d in docs])}
2020
)

l10n_it_fiscal_document_type/models/res_partner.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ class ResPartner(models.Model):
66

77
out_fiscal_document_type = fields.Many2one(
88
"fiscal.document.type",
9-
string="Out Fiscal Document Type",
109
)
1110
in_fiscal_document_type = fields.Many2one(
1211
"fiscal.document.type",
13-
string="In Fiscal Document Type",
1412
)

l10n_it_fiscal_document_type/readme/CONTRIBUTORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
* Gianmarco Conte <gconte@dinamicheaziendali.it>
44
* Sergio Zanchetta <https://github.com/primes2h>
55
* Alfredo Zamora <alfredo.zamora@agilebg.com>
6+
* Marco Colombo <marco.colombo@phi.technology>

l10n_it_fiscal_document_type/static/description/index.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
44
<head>
55
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6-
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
6+
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
77
<title>ITA - Tipi di documento fiscale per dichiarativi</title>
88
<style type="text/css">
99

@@ -367,7 +367,7 @@ <h1 class="title">ITA - Tipi di documento fiscale per dichiarativi</h1>
367367
!! This file is generated by oca-gen-addon-readme !!
368368
!! changes will be overwritten. !!
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
370-
<p><a class="reference external" 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" 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" href="https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_fiscal_document_type"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_fiscal_document_type"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/122/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
370+
<p><a class="reference external" 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" 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" href="https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_fiscal_document_type"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_fiscal_document_type"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/122/16.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
371371
<p><strong>Italiano</strong></p>
372372
<p>Tabella con codici tipo documento previsti dall’Agenzia delle Entrate.</p>
373373
<p><strong>English</strong></p>
@@ -400,7 +400,7 @@ <h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
400400
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-italy/issues">GitHub Issues</a>.
401401
In case of trouble, please check there if your issue has already been reported.
402402
If you spotted it first, help us smashing it by providing a detailed and welcomed
403-
<a class="reference external" href="https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_fiscal_document_type%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
403+
<a class="reference external" href="https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_fiscal_document_type%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
404404
<p>Do not contact contributors directly about support or help with technical issues.</p>
405405
</div>
406406
<div class="section" id="credits">
@@ -419,6 +419,7 @@ <h2><a class="toc-backref" href="#id5">Contributors</a></h2>
419419
<li>Gianmarco Conte &lt;<a class="reference external" href="mailto:gconte&#64;dinamicheaziendali.it">gconte&#64;dinamicheaziendali.it</a>&gt;</li>
420420
<li>Sergio Zanchetta &lt;<a class="reference external" href="https://github.com/primes2h">https://github.com/primes2h</a>&gt;</li>
421421
<li>Alfredo Zamora &lt;<a class="reference external" href="mailto:alfredo.zamora&#64;agilebg.com">alfredo.zamora&#64;agilebg.com</a>&gt;</li>
422+
<li>Marco Colombo &lt;<a class="reference external" href="mailto:marco.colombo&#64;phi.technology">marco.colombo&#64;phi.technology</a>&gt;</li>
422423
</ul>
423424
</div>
424425
<div class="section" id="other-credits">
@@ -435,7 +436,7 @@ <h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
435436
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
436437
mission is to support the collaborative development of Odoo features and
437438
promote its widespread use.</p>
438-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_fiscal_document_type">OCA/l10n-italy</a> project on GitHub.</p>
439+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_fiscal_document_type">OCA/l10n-italy</a> project on GitHub.</p>
439440
<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>
440441
</div>
441442
</div>

l10n_it_fiscal_document_type/tests/test_doc_type.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def test_doc_type_on_invoice_create(self):
107107
{
108108
"reason": "no reason",
109109
"refund_method": "cancel",
110+
"journal_id": invoice.journal_id.id,
110111
}
111112
)
112113
)
@@ -125,7 +126,7 @@ def _set_recompute_document_type(self, invoice, doc_type):
125126

126127
# Recompute document type for the invoice
127128
self.env.add_to_compute(invoice._fields["fiscal_document_type_id"], invoice)
128-
self.inv_model.flush()
129+
self.inv_model.flush_model()
129130
return invoice
130131

131132
def test_keep_edited_invoice(self):

0 commit comments

Comments
 (0)