-
-
Notifications
You must be signed in to change notification settings - Fork 788
[V18] account_invoice_auto_send_by_email - not working with Verifactu Spain #2285
Description
The error occurs while Odoo is trying to automatically send an invoice by email through a queued job. During the sending process, the Spanish Verifactu EDI module is triggered. This module attempts to create a Verifactu document record linked to the invoice.
While creating the record in the model l10n_es_edi_verifactu.document, Odoo tries to retrieve default values using ir.default. At that moment, the database transaction is already in a failed state. Because of that, PostgreSQL raises the error:
"current transaction is aborted, commands ignored until end of transaction block"
This means that an earlier database operation in the same transaction already failed, but the system continued executing code without properly rolling back the transaction. Once a transaction is marked as failed, PostgreSQL blocks all further queries until a rollback is performed.
Module
account_invoice_auto_send_by_email
Describe the bug
While creating the record in the model l10n_es_edi_verifactu.document, Odoo tries to retrieve default values using ir.default. At that moment, the database transaction is already in a failed state. Because of that, PostgreSQL raises the error:
"current transaction is aborted, commands ignored until end of transaction block"
This means that an earlier database operation in the same transaction already failed, but the system continued executing code without properly rolling back the transaction. Once a transaction is marked as failed, PostgreSQL blocks all further queries until a rollback is performed.
In short:
The invoice auto-send process triggers Verifactu.
Verifactu tries to create a document record.
Odoo attempts to fetch default values from ir.default.
The database transaction was already broken before this point.
PostgreSQL refuses further queries because the transaction is aborted.
The root cause is likely an earlier hidden database error during invoice processing or Verifactu preparation, not the ir.default call itself.
To properly diagnose it, you need to look for the first SQL error that happened before this traceback.
To Reproduce
18.0
Steps to reproduce the behavior:
- Create invoice and activate Verifactu
- Set autopoast on date and run job
- Task in Quejob is created with error.