Italiano
Questo modulo implementa il canale PEC (Posta Elettronica Certificata) per la comunicazione con il Sistema di Interscambio (SdI), in alternativa al proxy IAP standard di Odoo.
Si basa su l10n_it_edi_sdi per la logica condivisa di elaborazione
delle notifiche e ricezione delle fatture, aggiungendo il trasporto
specifico via PEC.
Funzionalità principali:
- Invio fatture elettroniche via PEC al SdI
- Ricezione email PEC dal SdI e instradamento ai gestori appropriati
- Gestione errori PEC con notifica automatica ai contatti configurati e disabilitazione del server dopo ripetuti fallimenti
- Configurazione server SMTP e IMAP/POP3 dedicati alla PEC
English
This module implements the PEC (Certified Email) transport channel for communication with the Italian Exchange System (SdI), as an alternative to Odoo's standard IAP proxy.
It builds on l10n_it_edi_sdi for the shared notification processing
and invoice reception logic, adding PEC-specific transport.
Main features:
- Send electronic invoices to SdI via PEC
- Receive PEC emails from SdI and route to appropriate handlers
- PEC error handling with automatic notification to configured contacts and server auto-disable after repeated failures
- Dedicated SMTP and IMAP/POP3 server configuration for PEC
Table of contents
Italiano
- Configurare un server SMTP in uscita per la PEC:
- Andare in Impostazioni → Tecnico → Server di posta in uscita
- Creare un nuovo server con i parametri del provider PEC
- Spuntare "E-invoice PEC server"
- Inserire l'indirizzo email PEC mittente
- Configurare un server di posta in ingresso per la PEC:
- Andare in Impostazioni → Tecnico → Server di posta in ingresso
- Creare un nuovo server IMAP o POP3 con i parametri del provider PEC
- Spuntare "E-invoice PEC server"
- Configurare i contatti da notificare in caso di errore
- Abilitare il canale PEC per l'azienda:
- Andare in Impostazioni → Contabilità → Fatturazione elettronica
- Spuntare "Use PEC for e-invoicing"
- Selezionare i server PEC in uscita e in ingresso
- Inserire l'indirizzo PEC del SdI
- Il parametro di sistema
fetchmail.pec.max.retry(default: 5) controlla il numero massimo di errori consecutivi prima che il server di posta in ingresso venga disabilitato automaticamente. Modificare il valore in Impostazioni → Tecnico → Parametri → Parametri di sistema se necessario.
English
- Configure an outgoing PEC SMTP server:
- Go to Settings → Technical → Outgoing Mail Servers
- Create a new server with your PEC provider parameters
- Check "E-invoice PEC server"
- Enter the PEC sender email address
- Configure an incoming PEC mail server:
- Go to Settings → Technical → Incoming Mail Servers
- Create a new IMAP or POP3 server with your PEC provider parameters
- Check "E-invoice PEC server"
- Configure contacts to notify on errors
- Enable PEC channel for the company:
- Go to Settings → Accounting → Italian Electronic Invoicing
- Check "Use PEC for e-invoicing"
- Select the outgoing and incoming PEC servers
- Enter the SdI PEC email address
- The system parameter
fetchmail.pec.max.retry(default: 5) controls the maximum number of consecutive errors before the incoming mail server is automatically disabled. Change its value in Settings → Technical → Parameters → System Parameters if needed.
Italiano
Le fatture vengono inviate al SdI tramite PEC quando si utilizza il normale flusso di invio fattura elettronica di Odoo. Il modulo intercetta l'invio e usa la PEC al posto del proxy IAP standard.
Le notifiche dal SdI vengono ricevute automaticamente tramite il cron di fetchmail. Lo stato della fattura viene aggiornato automaticamente in base alla notifica ricevuta:
- RC (Ricevuta di Consegna) → Inoltrata al destinatario
- NS (Notifica di Scarto) → Rifiutata
- MC (Mancata Consegna) → Inoltro al destinatario fallito
- NE (Notifica Esito) → Accettata/Rifiutata dal partner PA
- DT (Decorrenza Termini) → Accettata per decorrenza termini
Le fatture dei fornitori inviate tramite SdI vengono ricevute automaticamente via PEC e importate come fatture in bozza.
Il pulsante "Verifica stato" sulla fattura inviata avvia una lettura manuale della casella PEC per recuperare eventuali notifiche in attesa.
English
Invoices are sent to SdI via PEC when using Odoo's standard electronic invoice sending flow. The module intercepts the send and uses PEC instead of the standard IAP proxy.
SdI notifications are received automatically via the fetchmail cron. The invoice state is updated automatically based on the notification received:
- RC (Delivery Receipt) → Forwarded to recipient
- NS (Rejection) → Rejected
- MC (Failed Delivery) → Forward to recipient failed
- NE (Outcome Notification) → Accepted/Rejected by PA partner
- DT (Deadline Expiry) → Accepted after term expiry
Vendor bills sent through SdI are automatically received via PEC and imported as draft invoices.
The "Check status" button on a sent invoice triggers a manual PEC mailbox read to retrieve any pending notifications.
This module replaces l10n_it_fatturapa_pec (Odoo 16) with a complete
rewrite based on Odoo 18's native l10n_it_edi architecture.
The module was renamed from l10n_it_fatturapa_pec to
l10n_it_edi_pec.
Dependencies were drastically simplified:
- v16:
l10n_it_fatturapa_out,l10n_it_fatturapa_in,l10n_it_sdi_channel,mail - v18:
l10n_it_edi,mail
The modules l10n_it_fatturapa_out, l10n_it_fatturapa_in and
l10n_it_sdi_channel are no longer needed.
The module now extends Odoo 18's l10n_it_edi core methods instead of
implementing a standalone flow:
_l10n_it_edi_upload()onaccount.move: intercepts sending for PEC-enabled companies and sends directly via SMTP, with fallback tosuper()for the proxy channel_l10n_it_edi_update_send_state(): excludes PEC invoices from proxy polling_l10n_it_edi_export_check(): validates PEC configuration and removes the proxy user requirementaction_check_l10n_it_edi(): triggers PEC fetchmail for manual status check
The sdi.channel model has been completely removed. PEC configuration
is now managed directly on res.company through the fields:
l10n_it_edi_use_pec(Boolean)l10n_it_edi_pec_server_id(Many2one -> ir.mail_server)l10n_it_edi_pec_fetch_server_id(Many2one -> fetchmail.server)l10n_it_edi_pec_email_exchange_system(Char)
These fields are exposed in Settings via res.config.settings. The
views sdi_view.xml and company_view.xml are replaced by
res_config_settings_views.xml.
In v16, fatturapa.attachment.out managed the lifecycle of sent
invoices and SdI notification parsing (_message_type_ns,
_message_type_rc, etc.). In v18, the entire flow is handled directly
on account.move through the core notification chain:
_l10n_it_edi_parse_notification() ->
_l10n_it_edi_transform_notification() ->
_l10n_it_edi_get_message() -> _l10n_it_edi_write_send_state()
Incoming vendor bill reception no longer uses
fatturapa.attachment.in. The module now directly creates an empty
account.move, attaches the XML file and calls
move._extend_with_attachments() to populate fields from the
electronic invoice.
State mapping has changed to align with the l10n_it_edi core:
| SdI Code | v16 (fatturapa.attachment.out) | v18 (account.move) |
|---|---|---|
| NS (Notifica di Scarto) | sender_error |
rejected |
| RC (Ricevuta di Consegna) | validated |
forwarded |
| MC (Mancata Consegna) | recipient_error |
forward_failed |
| NE (Notifica Esito) | accepted /
rejected |
accepted /
rejected |
| DT (Decorrenza Termini) | validated |
accepted |
The first PEC sending management mechanism (first_invoice_sent field
on sdi.channel, initial address sdi01@pec.fatturapa.it and
automatic address change after first sending) has been removed. The SdI
PEC address must now be configured directly in the
l10n_it_edi_pec_email_exchange_system field.
- v16:
sdi.channel.send_via_pec()createdmail.messageandmail.mailrecords, then delegated sending to Odoo's mail system - v18:
_l10n_it_edi_upload()directly builds a PythonEmailMessageand sends it viair.mail_server.send_email(), without creating intermediate database records
| v16 | v18 |
|---|---|
is_fatturapa_pec |
is_l10n_it_edi_pec |
email_from_for_fatturaPA |
l10n_it_edi_pec_email_from |
The test base class changed from FatturaPACommon
(l10n_it_fatturapa_out.tests) to TestItEdi
(l10n_it_edi.tests.common), consistent with the new core extension
pattern.
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.
Do not contact contributors directly about support or help with technical issues.
- Andrea Colangelo (andreacolangelo@openforce.it)
- Sergio Corato https://efatto.it
- Lorenzo Battistini https://github.com/eLBati
- Sergio Zanchetta (Associazione PNLUG - Gruppo Odoo)
- Roberto Fichera https://levelprime.com
- Simone Rubino
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
This module is part of the OCA/l10n-italy project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.




