Daily updates from Odoo
Saturday, October 18, 2025
1 change · master
Resolved issues and error corrections
This fix prevents failed Chilean electronic invoice attachments from leaving the automated email import process in a broken database state. It helps the scheduled fetch continue handling recoverable import issues more reliably, reducing interruptions for invoice processing.
Original PR description
During l10n_cl_edi's fetchmail cron, if the decoding of a DTE attachment fails, `_create_records_from_attachments` rolls back the transaction, which prevents the savepoint in `_fetch_mail` from being…
During l10n_cl_edi's fetchmail cron, if the decoding of a DTE attachment fails, `_create_records_from_attachments` rolls back the transaction, which prevents the savepoint in `_fetch_mail` from being restored. Doing a commit/rollback within a `cr.savepoint()` is not correct. Since a new transaction is started, the savepoint no longer exists. Failing to restore the savepoint leaves the transaction in a broken state. Thus, we need to remove either the savepoint or the commit + rollback performed by `_create_records_from_attachments`. See https://github.com/odoo/odoo/issues/230014 We can remove the savepoint because `_extend_by_attachments` already catches exceptions which typically represent decoding errors (such as ValidationError, UserError, ValueError, psycopg2.errors.IntegrityError). These errors are recoverable from a transaction point of view; the import fraw recover from them by leaving an empty invoice with the attachment. Other errors are typically not recoverable and it does not makes sense to attempt to recover from them using a `cr.savepoint()`. opw-5147385 Forward-Port-Of: odoo/enterprise#97158