Skip to main content
VeriFactu

VeriFactu errors with foreign customers: 1239 and the IDOtro codes

When a customer has no Spanish tax ID, the invoice identifies them in the IDOtro block with three pieces of data: country, document type and number. The AEAT, the Spanish tax agency, has more than a dozen codes for when that combination does not add up, and the most generic one, 1239, only says there is an error in the recipient block. Here they all are, with what Odoo sends in each case.

FlexigoTech · Editor in charge: Víctor Gómez · Updated 4 November 2026

Key facts

Module
VeriFactu
Versions
Odoo 17, 18, 19 and 20
Checked
in the module's source code, version 20.0 · against the sources linked at the end
Reading time
5 min

How Odoo identifies a foreign customer

The module decides the identifier type when the invoice is posted, using two fields of the contact: the country and the tax ID (Odoo's VAT field).

Customer with country Spain, or no country
Sent in the NIF field. If the number starts with X, Y or Z, it is treated as an NIE, the ID of foreign residents.
Customer from another EU country
Sent in IDOtro with IDType 02 (EU VAT number) and no CodigoPais.
Customer from outside the EU
Sent in IDOtro with the CodigoPais of their country and IDType 04, or IDType 03 (passport) if the number has more than 20 characters or none that are alphanumeric.

The number travels with 20 characters at most. With this in mind, almost every code below is explained by two fields of the contact: country and tax ID.

Card for the VeriFactu IDOtro errors
Error 1239 and the thirteen recipient-block codes covered here, all from the section that rejects the record.

The codes, one by one

The AEAT texts are in Spanish; the right column says what each one points at.

CodeWhat the AEAT says, in shortWhat to check
1239Error en el bloque Destinatario.The whole block: country, tax ID and name of the contact.
1101El valor del campo CodigoPais es incorrecto.The contact's country.
1102El valor del campo IDType es incorrecto.The document type that was inferred.
1103El valor del campo ID es incorrecto.The contact's number.
1111CodigoPais is mandatory when IDType is not 02.A customer with no country in Odoo.
1122CodigoPais does not match the first two characters of the number.A number with another country's prefix.
1126CodigoPais ES only with IDType 03 or 07.A Spanish customer sent through IDOtro.
1131With IDType 07 the number must be the NIF of an individual.Type 07, which the module does not use.
1222El valor del campo ID del bloque IDOtro es incorrecto.The number of a foreign customer.
1232, 1233 and 1234IDOtro with CodigoPais ES requires IDType 03, 07 or one of the two.Spain as country on a passport customer.
1254 and 1255UK VAT numbers: XI is not accepted before 01/01/2021 and GB is not accepted from 01/02/2021.The operation date and the prefix.

For IDType 02 the AEAT also checks that the number has the EU VAT structure of the member state and is in capitals. In practice, a European customer's tax ID has to be stored in Odoo with its country prefix, as VIES validates it.

What happens in Odoo when the AEAT rejects it

These codes reject the record, not the submission: the other invoices in the same request go through. The queue puts the rejected one in Retrying and sends it again with growing waits, from 2 minutes to 12 hours; on the sixth attempt it moves to Dead Letter and the record becomes «Error permanente» (permanent error).

AEAT Errors in Odoo with a 1239 in Dead Letter
A 1239 after six attempts, in Dead Letter, next to two submissions in 4134. Odoo 20 screenshot with demo data and simulated AEAT answers.

Retrying changes nothing if the data is wrong, because the submission is built from the record created when the invoice was posted, not from the contact. That is why the fix has two parts:

  1. Correct the country or tax ID of the contact, so that the next invoices go out right.
  2. For the invoice already rejected, the AEAT provides a «registration after rejection», with Subsanacion S and RechazoPrevio X. The published module does not generate that record on its own: write to comercial@flexigobe.com with the invoice number and we will sort it out with you.

The codes on this page, with the AEAT's text

Each code with its literal text, in Spanish, as the AEAT's error list gives it:

CodeAEAT text (Spanish)
1239Error en el bloque Destinatario.
1101El valor del campo CodigoPais es incorrecto.
1102El valor del campo IDType es incorrecto.
1103El valor del campo ID es incorrecto.
1111El campo CodigoPais es obligatorio cuando IDType es distinto de NIF-IVA (02).
1122El campo CodigoPais indicado no coincide con los dos primeros dígitos del identificador.
1126El valor del CodigoPais solo puede ser ES cuando el IDType sea Pasaporte (03) o No Censado (07). Si IDType es No Censado (07) el CodigoPais debe ser ES (España).
1131El valor del campo ID ha de ser el NIF de una persona física cuando el campo IDType tiene valor No Censado (07).
1222El valor del campo ID del bloque IDOtro es incorrecto.
1232Si se identifica a través de la agrupación IDOtro y CodigoPais tiene valor ES (España), el campo IDType debe valer Pasaporte (03).
1233Si se identifica a través de la agrupación IDOtro y CodigoPais tiene valor ES (España), el campo IDType debe valer No Censado (07).
1234Si se identifica a través de la agrupación IDOtro y CodigoPais tiene valor ES (España), el campo IDType debe valer Pasaporte (03) o No Censado (07).
1254Si FechaOperacion (FechaExpedicionFactura si no se informa FechaOperacion) es anterior a 01/01/2021 no se permite el valor 'XI' para Identificaciones NIF-IVA
1255Si FechaOperacion (FechaExpedicionFactura si no se informa FechaOperacion) es mayor o igual que 01/02/2021 no se permite el valor 'GB' para Identificaciones NIF-IVA

If the code you see is not in this table, the full catalogue is in AEAT Submission › AEAT Error Catalogue, with the literal AEAT text.

Keep reading

VeriFactu errors with the customer tax ID: census, format and nameVeriFactu errors on the customer tax ID: census (1109, 1110, 1121, 1193, 1154), format (1123, 1290) and name (1283). What causes them and what Odoo checks before sending.VeriFactu errors 1189, 1190, 1191 and 1192: invoice type and recipient have to matchVeriFactu errors that cross the invoice type with the recipient (1189, 1190, 1191, 1192, 1106 and 1156): the AEAT rule and what Odoo decides when an invoice is posted.VeriFactu error 2001: your customer's tax ID is not in the AEAT censusVeriFactu error 2001: the recipient's tax ID is not in the AEAT census. Why the invoice is accepted anyway and what to do in Odoo 17 to 20.
Checked in the module's source code (version 20.0) and the linked sources

Sources