aeat.domain.iva._flow module¶
IVA flow direction enum — repercutido / soportado / INVERSION_SUJETO_PASIVO.
Codifies the IVA collectability axis the ledger and modelo registries
need alongside the operation-kind axis (IvaCategory) and the
rate axis (IvaRateKind). Every IVA-bearing ledger line
classifies along all three axes:
IvaCategory— operation kind (domestic, intracomunitaria, recargo, OSS, etc.).IvaRateKind— rate tier (general / reduced / super-reduced / zero / exempt).IvaFlowDirection— flow direction (output / input / self-assessed reverse charge).
Together the triple resolves to a single ledger-bookable Cuota.
The three flow directions are anchored to LIVA articles:
IvaFlowDirection.REPERCUTIDO— LIVA art. 88 (repercusión del impuesto). The sujeto pasivo charges IVA to its customer; the customer is the obligado a soportar.IvaFlowDirection.SOPORTADO— LIVA art. 92 (cuotas tributarias deducibles). The sujeto pasivo bears IVA via direct repercusión from suppliers and may deduct that IVA from its own output IVA.IvaFlowDirection.INVERSION_SUJETO_PASIVO— LIVA art. 84.Uno.2.º (inversión del sujeto pasivo). The recipient of certain operations (intra-community acquisitions, art. 84.Uno.2.º.f construction reverse charge, etc.) is the sujeto pasivo and self-assesses both an IVA repercutido entry (output) and a matching IVA soportado entry (input) on the same operation.
The derive_flow_for_classification() helper computes the flow
direction from the substrate’s IvaCategory plus the invoice
InvoiceKind axis so consumers do not have to encode the
mapping by hand.
Settlement-side cornerstones — devengada vs deducible¶
The IVA settlement model rests on two cornerstone concepts:
IVA devengada (output IVA, “cuota tributaria devengada”) — the amount the sujeto pasivo OWES to the Treasury as the IVA chargeable on its sales. LIVA arts. 75-77 establish when IVA accrues (devengo); LIVA art. 88 governs how the sujeto pasivo charges it to the customer (repercusión).
IVA deducible (input IVA, “cuotas tributarias deducibles”) — the amount the sujeto pasivo may DEDUCT from its devengada because it bore IVA on inputs. LIVA art. 92 establishes the right to deduction; arts. 93-104 establish the conditions, scope, and limits.
The cuota neta a ingresar (or a devolver) at the period level is devengada - deducible; this is the canonical Modelo 303 “resultado régimen general” line.
Every IvaFlowDirection member contributes to one or both
cornerstones:
Flow direction |
Devengada |
Deducible |
|---|---|---|
REPERCUTIDO |
✓ |
─ |
SOPORTADO |
─ |
✓ |
INVERSION_SUJETO_PASIVO |
✓ |
✓ |
INVERSION_SUJETO_PASIVO is the only flow that contributes to BOTH sides on the SAME operation: the recipient self-assesses an output entry (devengada) and a matching input entry (deducible) for the cuota that would have been repercutida by a non-existent or non-EU supplier. The two entries cancel arithmetically inside Modelo 303 (devengada - deducible = 0 for that line) but both must be booked to satisfy the LIVA art. 84.Uno.2 inversión-del-sujeto-pasivo mechanism.
The IvaSettlementSide enum + settlement_sides_for_flow()
helper let the ledger and modelo registries categorize transactions
without re-deriving the mapping. The closed-set helpers
is_devengada_flow() and is_deducible_flow() are the
canonical predicates for “does this flow contribute to the cuota
devengada / cuota deducible total?”.
- class IvaFlowDirection(*values)[source]¶
Bases:
StrEnumClosed enumeration of the IVA flow directions.
Members are kebab-case lowercase strings to align with TOML-driven binding selectors and ledger-side tagging.
- Variables:
REPERCUTIDO – Output IVA. The sujeto pasivo charges IVA to a customer in an invoice it issues. Anchored to LIVA art. 88.
SOPORTADO – Input IVA. The sujeto pasivo bears IVA charged by a supplier via direct repercusión and may deduct it under LIVA art. 92.
INVERSION_SUJETO_PASIVO – Self-assessed reverse charge. The sujeto pasivo is the recipient of an operation that triggers inversión del sujeto pasivo under LIVA art. 84.Uno.2.º (intra-community acquisitions, construction RC, waste RC, consumer-electronics RC, services received from EU non-established suppliers); the same operation lands as both a repercutido and a soportado entry in the books.
- REPERCUTIDO¶
- SOPORTADO¶
- INVERSION_SUJETO_PASIVO¶
- derive_flow_for_classification(*, category, invoice_direction)[source]¶
Return the IVA flow direction for a substrate-classified line.
The mapping is:
Reverse-charge categories (domestic RC, intra-community acquisition RC) always resolve to
IvaFlowDirection.INVERSION_SUJETO_PASIVO, irrespective of the invoice direction. The substrate’s classifier emits these for operations where the recipient self-assesses both output and input IVA on the same operation.Otherwise:
InvoiceKind.ISSUEDresolves toIvaFlowDirection.REPERCUTIDO(the autónomo charged output IVA on a sale) andInvoiceKind.RECEIVEDresolves toIvaFlowDirection.SOPORTADO(the autónomo bore input IVA on a purchase).
- Parameters:
category (
IvaCategory) – TheIvaCategoryresolved by the substrate classifier.invoice_direction (
InvoiceKind) – Whether the invoice was issued or received by the autónomo.
- Return type:
- Returns:
The
IvaFlowDirectionthat matches the classification.
- class IvaSettlementSide(*values)[source]¶
Bases:
StrEnumClosed enumeration of the two cornerstones of IVA settlement.
Modelo 303 / 322 / 353 / 309 / 390 settlement is the difference between the two sides; downstream filing and verification logic classify cuotas into these two buckets.
- Variables:
DEVENGADA – Output IVA — the amount owed to the Treasury, arising from sales (LIVA art. 88 repercusión) or self-assessed reverse-charge entries (LIVA art. 84.Uno.2).
DEDUCIBLE – Input IVA — the amount deductible from the devengada total because the sujeto pasivo bore IVA on inputs (LIVA art. 92 cuotas tributarias deducibles).
- DEVENGADA¶
- DEDUCIBLE¶
- settlement_sides_for_flow(flow)[source]¶
Return the settlement side(s)
flowcontributes to.- Parameters:
flow (
IvaFlowDirection) – TheIvaFlowDirectionto classify.- Returns:
{DEVENGADA}forIvaFlowDirection.REPERCUTIDO,{DEDUCIBLE}forIvaFlowDirection.SOPORTADO,{DEVENGADA, DEDUCIBLE}forIvaFlowDirection.INVERSION_SUJETO_PASIVO.- Return type:
Frozenset of
IvaSettlementSidevalues
- is_devengada_flow(flow)[source]¶
Return
Trueiffflowcontributes to cuota devengada.Canonical predicate for the ledger / modelo registries when aggregating cuota devengada totals — equivalent to
flow in {REPERCUTIDO, INVERSION_SUJETO_PASIVO}but anchored to the substrate’s settlement-side codification so downstream consumers don’t have to re-enumerate the mapping.- Return type:
- Parameters:
flow (IvaFlowDirection)
- is_deducible_flow(flow)[source]¶
Return
Trueiffflowcontributes to cuota deducible.Canonical predicate for the ledger / modelo registries when aggregating cuota deducible totals — equivalent to
flow in {SOPORTADO, INVERSION_SUJETO_PASIVO}but anchored to the substrate’s settlement-side codification.- Return type:
- Parameters:
flow (IvaFlowDirection)
- DEVENGADA_FLOW_DIRECTIONS: frozenset[IvaFlowDirection]¶
Public frozen set of flow directions contributing to cuota devengada.
Re-exported for binding selectors and ledger filters that operate at the flow-set level rather than the per-flow predicate level.
- DEDUCIBLE_FLOW_DIRECTIONS: frozenset[IvaFlowDirection]¶
Public frozen set of flow directions contributing to cuota deducible.