Skip to content

Commit 4e8ab05

Browse files
committed
[MIG] l10n_it_edi_pec: Migration to 19.0
1 parent d8e2c65 commit 4e8ab05

9 files changed

Lines changed: 132 additions & 195 deletions

File tree

l10n_it_edi_pec/README.rst

Lines changed: 97 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ ITA - Fattura elettronica - Supporto PEC
2121
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
2222
:alt: License: AGPL-3
2323
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github
24-
:target: https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_edi_pec
24+
:target: https://github.com/OCA/l10n-italy/tree/19.0/l10n_it_edi_pec
2525
:alt: OCA/l10n-italy
2626
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27-
:target: https://translation.odoo-community.org/projects/l10n-italy-18-0/l10n-italy-18-0-l10n_it_edi_pec
27+
:target: https://translation.odoo-community.org/projects/l10n-italy-19-0/l10n-italy-19-0-l10n_it_edi_pec
2828
:alt: Translate me on Weblate
2929
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30-
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&target_branch=18.0
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&target_branch=19.0
3131
:alt: Try me on Runboat
3232

3333
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -44,11 +44,11 @@ specifico via PEC.
4444

4545
Funzionalità principali:
4646

47-
- Invio fatture elettroniche via PEC al SdI
48-
- Ricezione email PEC dal SdI e instradamento ai gestori appropriati
49-
- Gestione errori PEC con notifica automatica ai contatti configurati e
50-
disabilitazione del server dopo ripetuti fallimenti
51-
- Configurazione server SMTP e IMAP/POP3 dedicati alla PEC
47+
- Invio fatture elettroniche via PEC al SdI
48+
- Ricezione email PEC dal SdI e instradamento ai gestori appropriati
49+
- Gestione errori PEC con notifica automatica ai contatti configurati e
50+
disabilitazione del server dopo ripetuti fallimenti
51+
- Configurazione server SMTP e IMAP/POP3 dedicati alla PEC
5252

5353
**English**
5454

@@ -61,11 +61,11 @@ and invoice reception logic, adding PEC-specific transport.
6161

6262
Main features:
6363

64-
- Send electronic invoices to SdI via PEC
65-
- Receive PEC emails from SdI and route to appropriate handlers
66-
- PEC error handling with automatic notification to configured contacts
67-
and server auto-disable after repeated failures
68-
- Dedicated SMTP and IMAP/POP3 server configuration for PEC
64+
- Send electronic invoices to SdI via PEC
65+
- Receive PEC emails from SdI and route to appropriate handlers
66+
- PEC error handling with automatic notification to configured contacts
67+
and server auto-disable after repeated failures
68+
- Dedicated SMTP and IMAP/POP3 server configuration for PEC
6969

7070
**Table of contents**
7171

@@ -79,24 +79,25 @@ Configuration
7979

8080
1. Configurare un server SMTP in uscita per la PEC:
8181

82-
- Andare in *Impostazioni → Tecnico → Server di posta in uscita*
83-
- Creare un nuovo server con i parametri del provider PEC
84-
- Spuntare "E-invoice PEC server"
85-
- Inserire l'indirizzo email PEC mittente
82+
- Andare in *Impostazioni → Tecnico → Server di posta in uscita*
83+
- Creare un nuovo server con i parametri del provider PEC
84+
- Spuntare "E-invoice PEC server"
85+
- Inserire l'indirizzo email PEC mittente
8686

8787
2. Configurare un server di posta in ingresso per la PEC:
8888

89-
- Andare in *Impostazioni → Tecnico → Server di posta in ingresso*
90-
- Creare un nuovo server IMAP o POP3 con i parametri del provider PEC
91-
- Spuntare "E-invoice PEC server"
92-
- Configurare i contatti da notificare in caso di errore
89+
- Andare in *Impostazioni → Tecnico → Server di posta in ingresso*
90+
- Creare un nuovo server IMAP o POP3 con i parametri del provider
91+
PEC
92+
- Spuntare "E-invoice PEC server"
93+
- Configurare i contatti da notificare in caso di errore
9394

9495
3. Abilitare il canale PEC per l'azienda:
9596

96-
- Andare in *Impostazioni → Contabilità → Fatturazione elettronica*
97-
- Spuntare "Use PEC for e-invoicing"
98-
- Selezionare i server PEC in uscita e in ingresso
99-
- Inserire l'indirizzo PEC del SdI
97+
- Andare in *Impostazioni → Contabilità → Fatturazione elettronica*
98+
- Spuntare "Use PEC for e-invoicing"
99+
- Selezionare i server PEC in uscita e in ingresso
100+
- Inserire l'indirizzo PEC del SdI
100101

101102
4. Il parametro di sistema ``fetchmail.pec.max.retry`` (default: 5)
102103
controlla il numero massimo di errori consecutivi prima che il server
@@ -108,24 +109,24 @@ Configuration
108109

109110
1. Configure an outgoing PEC SMTP server:
110111

111-
- Go to *Settings → Technical → Outgoing Mail Servers*
112-
- Create a new server with your PEC provider parameters
113-
- Check "E-invoice PEC server"
114-
- Enter the PEC sender email address
112+
- Go to *Settings → Technical → Outgoing Mail Servers*
113+
- Create a new server with your PEC provider parameters
114+
- Check "E-invoice PEC server"
115+
- Enter the PEC sender email address
115116

116117
2. Configure an incoming PEC mail server:
117118

118-
- Go to *Settings → Technical → Incoming Mail Servers*
119-
- Create a new IMAP or POP3 server with your PEC provider parameters
120-
- Check "E-invoice PEC server"
121-
- Configure contacts to notify on errors
119+
- Go to *Settings → Technical → Incoming Mail Servers*
120+
- Create a new IMAP or POP3 server with your PEC provider parameters
121+
- Check "E-invoice PEC server"
122+
- Configure contacts to notify on errors
122123

123124
3. Enable PEC channel for the company:
124125

125-
- Go to *Settings → Accounting → Italian Electronic Invoicing*
126-
- Check "Use PEC for e-invoicing"
127-
- Select the outgoing and incoming PEC servers
128-
- Enter the SdI PEC email address
126+
- Go to *Settings → Accounting → Italian Electronic Invoicing*
127+
- Check "Use PEC for e-invoicing"
128+
- Select the outgoing and incoming PEC servers
129+
- Enter the SdI PEC email address
129130

130131
4. The system parameter ``fetchmail.pec.max.retry`` (default: 5)
131132
controls the maximum number of consecutive errors before the incoming
@@ -151,11 +152,11 @@ Le notifiche dal SdI vengono ricevute automaticamente tramite il cron di
151152
fetchmail. Lo stato della fattura viene aggiornato automaticamente in
152153
base alla notifica ricevuta:
153154

154-
- RC (Ricevuta di Consegna) → Inoltrata al destinatario
155-
- NS (Notifica di Scarto) → Rifiutata
156-
- MC (Mancata Consegna) → Inoltro al destinatario fallito
157-
- NE (Notifica Esito) → Accettata/Rifiutata dal partner PA
158-
- DT (Decorrenza Termini) → Accettata per decorrenza termini
155+
- RC (Ricevuta di Consegna) → Inoltrata al destinatario
156+
- NS (Notifica di Scarto) → Rifiutata
157+
- MC (Mancata Consegna) → Inoltro al destinatario fallito
158+
- NE (Notifica Esito) → Accettata/Rifiutata dal partner PA
159+
- DT (Decorrenza Termini) → Accettata per decorrenza termini
159160

160161
Ricezione fatture passive
161162
-------------------------
@@ -185,11 +186,11 @@ SdI notifications are received automatically via the fetchmail cron. The
185186
invoice state is updated automatically based on the notification
186187
received:
187188

188-
- RC (Delivery Receipt) → Forwarded to recipient
189-
- NS (Rejection) → Rejected
190-
- MC (Failed Delivery) → Forward to recipient failed
191-
- NE (Outcome Notification) → Accepted/Rejected by PA partner
192-
- DT (Deadline Expiry) → Accepted after term expiry
189+
- RC (Delivery Receipt) → Forwarded to recipient
190+
- NS (Rejection) → Rejected
191+
- MC (Failed Delivery) → Forward to recipient failed
192+
- NE (Outcome Notification) → Accepted/Rejected by PA partner
193+
- DT (Deadline Expiry) → Accepted after term expiry
193194

194195
Receiving vendor bills
195196
----------------------
@@ -220,9 +221,9 @@ The module was renamed from ``l10n_it_fatturapa_pec`` to
220221

221222
Dependencies were drastically simplified:
222223

223-
- **v16**: ``l10n_it_fatturapa_out``, ``l10n_it_fatturapa_in``,
224-
``l10n_it_sdi_channel``, ``mail``
225-
- **v18**: ``l10n_it_edi``, ``mail``
224+
- **v16**: ``l10n_it_fatturapa_out``, ``l10n_it_fatturapa_in``,
225+
``l10n_it_sdi_channel``, ``mail``
226+
- **v18**: ``l10n_it_edi``, ``mail``
226227

227228
The modules ``l10n_it_fatturapa_out``, ``l10n_it_fatturapa_in`` and
228229
``l10n_it_sdi_channel`` are no longer needed.
@@ -233,26 +234,26 @@ Integration with l10n_it_edi core
233234
The module now extends Odoo 18's ``l10n_it_edi`` core methods instead of
234235
implementing a standalone flow:
235236

236-
- ``_l10n_it_edi_upload()`` on ``account.move``: intercepts sending for
237-
PEC-enabled companies and sends directly via SMTP, with fallback to
238-
``super()`` for the proxy channel
239-
- ``_l10n_it_edi_update_send_state()``: excludes PEC invoices from proxy
240-
polling
241-
- ``_l10n_it_edi_export_check()``: validates PEC configuration and
242-
removes the proxy user requirement
243-
- ``action_check_l10n_it_edi()``: triggers PEC fetchmail for manual
244-
status check
237+
- ``_l10n_it_edi_upload()`` on ``account.move``: intercepts sending for
238+
PEC-enabled companies and sends directly via SMTP, with fallback to
239+
``super()`` for the proxy channel
240+
- ``_l10n_it_edi_update_send_state()``: excludes PEC invoices from
241+
proxy polling
242+
- ``_l10n_it_edi_export_check()``: validates PEC configuration and
243+
removes the proxy user requirement
244+
- ``action_check_l10n_it_edi()``: triggers PEC fetchmail for manual
245+
status check
245246

246247
Removed sdi.channel model
247248
~~~~~~~~~~~~~~~~~~~~~~~~~
248249

249250
The ``sdi.channel`` model has been completely removed. PEC configuration
250251
is now managed directly on ``res.company`` through the fields:
251252

252-
- ``l10n_it_edi_use_pec`` (Boolean)
253-
- ``l10n_it_edi_pec_server_id`` (Many2one -> ir.mail_server)
254-
- ``l10n_it_edi_pec_fetch_server_id`` (Many2one -> fetchmail.server)
255-
- ``l10n_it_edi_pec_email_exchange_system`` (Char)
253+
- ``l10n_it_edi_use_pec`` (Boolean)
254+
- ``l10n_it_edi_pec_server_id`` (Many2one -> ir.mail_server)
255+
- ``l10n_it_edi_pec_fetch_server_id`` (Many2one -> fetchmail.server)
256+
- ``l10n_it_edi_pec_email_exchange_system`` (Char)
256257

257258
These fields are exposed in Settings via ``res.config.settings``. The
258259
views ``sdi_view.xml`` and ``company_view.xml`` are replaced by
@@ -284,25 +285,26 @@ SdI state mapping
284285

285286
State mapping has changed to align with the ``l10n_it_edi`` core:
286287

287-
+----------------------+----------------------------+----------------------+
288-
| SdI Code | v16 | v18 (account.move) |
289-
| | (fatturapa.attachment.out) | |
290-
+======================+============================+======================+
291-
| NS (Notifica di | ``sender_error`` | ``rejected`` |
292-
| Scarto) | | |
293-
+----------------------+----------------------------+----------------------+
294-
| RC (Ricevuta di | ``validated`` | ``forwarded`` |
295-
| Consegna) | | |
296-
+----------------------+----------------------------+----------------------+
297-
| MC (Mancata | ``recipient_error`` | ``forward_failed`` |
298-
| Consegna) | | |
299-
+----------------------+----------------------------+----------------------+
300-
| NE (Notifica Esito) | ``accepted`` / | ``accepted`` / |
301-
| | ``rejected`` | ``rejected`` |
302-
+----------------------+----------------------------+----------------------+
303-
| DT (Decorrenza | ``validated`` | ``accepted`` |
304-
| Termini) | | |
305-
+----------------------+----------------------------+----------------------+
288+
+----------------------+----------------------+----------------------+
289+
| SdI Code | v16 | v18 (account.move) |
290+
| | (fattu | |
291+
| | rapa.attachment.out) | |
292+
+======================+======================+======================+
293+
| NS (Notifica di | ``sender_error`` | ``rejected`` |
294+
| Scarto) | | |
295+
+----------------------+----------------------+----------------------+
296+
| RC (Ricevuta di | ``validated`` | ``forwarded`` |
297+
| Consegna) | | |
298+
+----------------------+----------------------+----------------------+
299+
| MC (Mancata | ``recipient_error`` | ``forward_failed`` |
300+
| Consegna) | | |
301+
+----------------------+----------------------+----------------------+
302+
| NE (Notifica Esito) | ``accepted`` / | ``accepted`` / |
303+
| | ``rejected`` | ``rejected`` |
304+
+----------------------+----------------------+----------------------+
305+
| DT (Decorrenza | ``validated`` | ``accepted`` |
306+
| Termini) | | |
307+
+----------------------+----------------------+----------------------+
306308

307309
Removed first_invoice_sent flow
308310
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -316,11 +318,11 @@ PEC address must now be configured directly in the
316318
Simplified sending mechanism
317319
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
318320

319-
- **v16**: ``sdi.channel.send_via_pec()`` created ``mail.message`` and
320-
``mail.mail`` records, then delegated sending to Odoo's mail system
321-
- **v18**: ``_l10n_it_edi_upload()`` directly builds a Python
322-
``EmailMessage`` and sends it via ``ir.mail_server.send_email()``,
323-
without creating intermediate database records
321+
- **v16**: ``sdi.channel.send_via_pec()`` created ``mail.message`` and
322+
``mail.mail`` records, then delegated sending to Odoo's mail system
323+
- **v18**: ``_l10n_it_edi_upload()`` directly builds a Python
324+
``EmailMessage`` and sends it via ``ir.mail_server.send_email()``,
325+
without creating intermediate database records
324326

325327
Field renames
326328
~~~~~~~~~~~~~
@@ -346,7 +348,7 @@ Bug Tracker
346348
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/issues>`_.
347349
In case of trouble, please check there if your issue has already been reported.
348350
If you spotted it first, help us to smash it by providing a detailed and welcomed
349-
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_edi_pec%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
351+
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_edi_pec%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
350352

351353
Do not contact contributors directly about support or help with technical issues.
352354

@@ -356,12 +358,12 @@ Credits
356358
Contributors
357359
------------
358360

359-
- Andrea Colangelo (andreacolangelo@openforce.it)
360-
- Sergio Corato https://efatto.it
361-
- Lorenzo Battistini https://github.com/eLBati
362-
- Sergio Zanchetta (Associazione PNLUG - Gruppo Odoo)
363-
- Roberto Fichera https://levelprime.com
364-
- Simone Rubino
361+
- Andrea Colangelo (andreacolangelo@openforce.it)
362+
- Sergio Corato https://efatto.it
363+
- Lorenzo Battistini https://github.com/eLBati
364+
- Sergio Zanchetta (Associazione PNLUG - Gruppo Odoo)
365+
- Roberto Fichera https://levelprime.com
366+
- Simone Rubino
365367

366368
Maintainers
367369
-----------
@@ -376,6 +378,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
376378
mission is to support the collaborative development of Odoo features and
377379
promote its widespread use.
378380

379-
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_edi_pec>`_ project on GitHub.
381+
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/19.0/l10n_it_edi_pec>`_ project on GitHub.
380382

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

l10n_it_edi_pec/__init__.py

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -4,71 +4,3 @@
44
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
55

66
from . import models
7-
8-
from openupgradelib import openupgrade, openupgrade_tools
9-
10-
11-
def _l10n_it_edi_pec_pre_init_hook(env):
12-
if not openupgrade.is_module_installed(env.cr, "l10n_it_fatturapa_pec"):
13-
return
14-
openupgrade.rename_fields(
15-
env,
16-
[
17-
(
18-
"fetchmail.server",
19-
"fetchmail_server",
20-
"is_fatturapa_pec",
21-
"is_l10n_it_edi_pec",
22-
),
23-
(
24-
"ir.mail_server",
25-
"ir_mail_server",
26-
"is_fatturapa_pec",
27-
"is_l10n_it_edi_pec",
28-
),
29-
(
30-
"ir.mail_server",
31-
"ir_mail_server",
32-
"email_from_for_fatturaPA",
33-
"l10n_it_edi_pec_email_from",
34-
),
35-
],
36-
)
37-
# Update ir_model_data for the fetchmail.pec.max.retry parameter
38-
# so that the new module doesn't create a duplicate
39-
openupgrade.logged_query(
40-
env.cr,
41-
"""
42-
UPDATE ir_model_data
43-
SET module = 'l10n_it_edi_pec'
44-
WHERE module = 'l10n_it_fatturapa_pec'
45-
AND name = 'fetchmail_pec_max_retry'
46-
""",
47-
)
48-
49-
50-
def _l10n_it_edi_pec_post_init_hook(env):
51-
if not openupgrade.is_module_installed(env.cr, "l10n_it_fatturapa_pec"):
52-
return
53-
# Migrate PEC settings from sdi.channel to res.company.
54-
# In v16, PEC settings were stored on sdi.channel records linked
55-
# to companies via res_company.sdi_channel_id. In v18, they are stored
56-
# directly on res.company.
57-
if not openupgrade_tools.table_exists(env.cr, "sdi_channel"):
58-
return
59-
if not openupgrade.column_exists(env.cr, "res_company", "sdi_channel_id"):
60-
return
61-
openupgrade.logged_query(
62-
env.cr,
63-
"""
64-
UPDATE res_company
65-
SET
66-
l10n_it_edi_use_pec = True,
67-
l10n_it_edi_pec_server_id = sc.pec_server_id,
68-
l10n_it_edi_pec_fetch_server_id = sc.fetch_pec_server_id,
69-
l10n_it_edi_pec_email_exchange_system = sc.email_exchange_system
70-
FROM sdi_channel sc
71-
WHERE res_company.sdi_channel_id = sc.id
72-
AND sc.channel_type = 'pec'
73-
""",
74-
)

l10n_it_edi_pec/__manifest__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
{
77
"name": "ITA - Fattura elettronica - Supporto PEC",
8-
"version": "18.0.1.0.0",
8+
"version": "19.0.1.0.0",
99
"category": "Localization/Italy",
1010
"summary": "Invio e ricezione fatture elettroniche tramite PEC",
1111
"author": "Odoo Community Association (OCA)",
@@ -28,6 +28,4 @@
2828
"views/ir_mail_server_view.xml",
2929
],
3030
"installable": True,
31-
"pre_init_hook": "_l10n_it_edi_pec_pre_init_hook",
32-
"post_init_hook": "_l10n_it_edi_pec_post_init_hook",
3331
}

0 commit comments

Comments
 (0)