aeat.domain.invoices._enums module¶
Closed enumerations for invoice records.
Defines IvaRate and PaymentStatus together with the
iva_rate_percentage() helper that resolves the numeric Decimal
percentage backing each IvaRate member.
The percentage helper queries the centralized IVA substrate at
aeat.domain.iva rather than carrying its own rate literals.
IvaRate keeps its closed-taxonomy role for invoice records;
the legal-grade percentage value lives in
registry/aeat/iva/rates.toml and is dated.
- class IvaRate(*values)[source]¶
Bases:
StrEnumClosed taxonomy of Spanish IVA rate slots used on invoice lines.
The slot names map to substrate
aeat.domain.iva.IvaRateKindtiers and the percentage backing each slot is resolved againstaeat.domain.iva.lookup_rate()for Spain at a given date. This module no longer stores rate percentages as Python literals; if the legal rate changes, the substrate’s TOML registry is the single source of truth.RATE_5(a transient 2022-2024 rate) is intentionally absent from this slot taxonomy. If a future workflow ingests pre-2025 data this enum and the slot mapping below must be extended in sync with a corresponding registry rate entry.- Variables:
RATE_0 – Zero-rated supply.
RATE_4 – Super-reduced rate slot (LIVA art. 91 Dos).
RATE_10 – Reduced rate slot (LIVA art. 91 Uno).
RATE_21 – General rate slot (LIVA art. 90 Uno).
EXEMPT – Exempt operation; no numeric percentage.
NOT_SUBJECT – Operation outside the scope of IVA; no numeric percentage.
- RATE_0¶
- RATE_4¶
- RATE_10¶
- RATE_21¶
- EXEMPT¶
- NOT_SUBJECT¶
- class PaymentStatus(*values)[source]¶
Bases:
StrEnumLifecycle states for an invoice payment.
- Variables:
PAID – Settled in full.
PENDING – Awaiting payment within agreed terms.
PARTIALLY_PAID – Partially settled; remainder outstanding.
OVERDUE – Past the due date and still outstanding.
CANCELLED – Cancelled, regardless of whether previously paid.
- PAID¶
- PENDING¶
- PARTIALLY_PAID¶
- OVERDUE¶
- CANCELLED¶
- iva_rate_percentage(rate, on_date=None)[source]¶
Return the fractional percentage backing
rateaton_date.Slot membership in
IvaRateis structural; the actual percentage is resolved againstaeat.domain.iva.lookup_rate()for Spain aton_date. Whenon_dateis omitted the lookup uses today’s date.- Parameters:
- Return type:
- Returns:
Decimal("0")forIvaRate.RATE_0; the substrate’s rate as a fractional Decimal (pct/100) for theRATE_4/RATE_10/RATE_21slots;NoneforIvaRate.EXEMPTandIvaRate.NOT_SUBJECT.
- iva_rate_kind(rate)[source]¶
Return the substrate rate tier for an invoice line rate slot.
NOT_SUBJECThas no OSS/IOSS rate tier because it is outside the taxable-supply universe; callers that need a Modelo 369 candidate should skip or reject it explicitly. Numeric and exempt slots return their correspondingIvaRateKind.- Return type:
- Parameters:
rate (IvaRate)
- numeric_iva_rate_percentages()[source]¶
Return the integer-percentage values for the numeric
IvaRateslots.Parses the
RATE_<n>member names ofIvaRateto derive the closed set of integer percentages the CLI boundary accepts on--set iva.rate.IvaRate.EXEMPTandIvaRate.NOT_SUBJECTcarry no numeric percentage and are excluded.The derivation is structural — the
RATE_prefix is stripped and the remainder is parsed as an integer — so the returned set tracksIvaRatemembership without re-listing0 / 4 / 10 / 21as literals.