Invoices have the Party Tax Identifier field. There, only some of the types of party identifiers are allowed.
Spanish authorities allow that an invoice is made to a party who identifies using a passport, which in many cases cannot be validated (there’s no redundant information to be validated) and Tryton will not allow a passport as a Party Tax Identifier in invoices.
Should we customize our localization modules to allow that or should that be part of core?
I don’t think that a passport is related to taxes but it is related to a means of identifying a person. It is the person (natural person or legal entity) that pays the taxes.
You can see the type of documents allowed at page 228 here:
AEAT, Spanish authorities, require that all invoices to be sent to them via webservices.
Until recently that was called SII (Sistema Inmediato de Información) and applied to larger companies only (or those that choosed to do it). SII requires you to send customer and supplier invoices.
SII will still be available but starting January 2026 another webservice named Verifactu, requires all companies (those not using SII) to send all customer invoices immediately.
Both of those webservices expect you to send to whom you’ve sent the invoice. You’ll facilitate the name of the company or individual but also requires you to indicate which is the identifying document used.
As indicated in page 228 of the aforementioned document, several identifiers can be used and that includes standard “tax” identifiers as well as passport or other types of documents.
In fact, current core account_es module implements a method es_vat_type() that returns the appropriate code, but does not cover the case of passport neither all other possible document types:
So to answer your question: the purpose of the identifier is to identify the party and let the authorities know which document number and document type was used.
For me the identifier is not for tax but for identification only. So you could implement a method on Party similar to get_tax_identifier which calls _get_identifier with the set of supported types.