aeat.domain.contribuyente.assets package

Asset ledger records for actividad economica amortizacion tracking.

Provides the strict, frozen pydantic v2 records that back the registry-backed amortizacion workflow: AssetRecord (a depreciable asset affected to an economic activity), AmortizacionLedger (the recorded per-asset / per- year accruals), and LibertadAmortizacionElection.

exception AssetRecordError(message=None, *, context=None, suggestion=None, translated_message=None)[source]

Bases: AeatError

Raised when an asset record is structurally invalid.

Parameters:
  • message (str | None)

  • context (dict[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

code: ClassVar[ErrorCode]
exception AssetValidationError(message=None, *, context=None, suggestion=None, translated_message=None)[source]

Bases: AssetRecordError, ValueError

Raised when an asset record fails Pydantic validation.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

code: ClassVar[ErrorCode]
ASSETS_SCHEMA_VERSION

Forward-compatible schema version stamped onto every record in this module.

class AssetClass(*values)[source]

Bases: StrEnum

Asset category token retained for encrypted user-ledger records.

OBRA_CIVIL_GENERAL
OBRA_CIVIL_PAVIMENTOS
OBRA_CIVIL_INFRA_MINERAS
CENTRALES_HIDRAULICAS
CENTRALES_NUCLEARES
CENTRALES_CARBON
CENTRALES_RENOVABLES
CENTRALES_OTRAS
EDIFICIOS_INDUSTRIALES
EDIFICIOS_ESCOMBRERAS
EDIFICIOS_ALMACENES
EDIFICIOS_COMERCIALES
INSTALACIONES_SUBESTACIONES
INSTALACIONES_CABLES
INSTALACIONES_RESTO
MAQUINARIA_GENERAL
MAQUINARIA_MEDICOS
TRANSPORTE_LOCOMOTORAS
TRANSPORTE_BUQUES_AERONAVES
TRANSPORTE_INTERNO
TRANSPORTE_EXTERNO
TRANSPORTE_AUTOCAMIONES
MOBILIARIO_GENERAL
MOBILIARIO_LENCERIA
MOBILIARIO_CRISTALERIA
MOBILIARIO_UTILES
MOBILIARIO_MOLDES
MOBILIARIO_OTROS
ELECTRONICA_GENERAL
ELECTRONICA_INFORMATICA
ELECTRONICA_SOFTWARE
PRODUCCIONES_AUDIOVISUALES
OTROS_ELEMENTOS
class LibertadAmortizacionElection(**data)[source]

Bases: BaseModel

Opt-in election for LIS art. 12 accelerated amortization cases.

Variables:
  • enabled – Whether the asset opts into accelerated amortization.

  • legal_basis – BOE provision the election leans on (free-text citation for audit).

  • amount_limit – Optional ceiling on the accelerated amount per year. Must be strictly positive when set.

Parameters:
  • enabled (bool)

  • legal_basis (str | None)

  • amount_limit (Decimal | None)

enabled: bool
legal_basis: str | None
amount_limit: Decimal | None
class AssetRecord(**data)[source]

Bases: BaseModel

A depreciable asset affected to an economic activity.

Strict, frozen, no extra fields. Tracks both the invoice-level IVA decomposition (taxable_base / iva_amount / gross_total) and the derived cost_basis used as the depreciable basis. When only a fraction of input IVA is deductible, the non-deductible portion is rolled into cost_basis per LIS / LIRPF practice.

Variables:
  • identifier – Stable natural key chosen by the operator.

  • description – Free-text human description.

  • asset_class – Asset class token. Legal coefficients are supplied by registry definitions, not this record module.

  • acquisition_date – Date the asset was acquired.

  • cost_basis – Depreciable basis. Strictly positive.

  • taxable_base – Invoice taxable base (IVA-exclusive). When set, cost_basis must equal taxable_base + non-deductible IVA.

  • iva_rate – IVA percentage applied to the invoice (0-100).

  • iva_amount – Optional explicit IVA amount; when set, must equal taxable_base * iva_rate / 100.

  • deductible_iva_ratio – Fraction of input IVA the contribuyente may deduct (0-1).

  • gross_total – Optional explicit invoice total; when set, must equal taxable_base + iva_amount.

  • useful_life_years – Override for the LIS art. 12.1.a default coefficient. Must not exceed the table maximum coefficient or period for asset_class.

  • libertad_amortizacionLibertadAmortizacionElection.

  • actividad_id – Optional activity identifier when the asset is allocated to a specific actividad.

  • allocation_ratio – Fraction of the asset allocated to the activity (0-1).

  • schema_version – Forward-compatible schema version. "1".

Parameters:
identifier: str
description: str
asset_class: AssetClass
acquisition_date: date
cost_basis: Decimal
taxable_base: Decimal | None
iva_rate: Decimal
iva_amount: Decimal | None
deductible_iva_ratio: Decimal
gross_total: Decimal | None
useful_life_years: int | None
libertad_amortizacion: LibertadAmortizacionElection
actividad_id: str | None
allocation_ratio: Decimal
schema_version: str
property resolved_taxable_base: Decimal

Return the invoice taxable base, falling back to cost_basis.

property resolved_iva_amount: Decimal

Return the explicit IVA amount or derive it from the taxable base and rate.

property resolved_gross_total: Decimal

Return the explicit gross total or derive it from base + IVA.

class AmortizacionEntry(**data)[source]

Bases: BaseModel

One immutable amortizacion amount for an asset/year.

Variables:
  • asset_id – Foreign key into AssetRecord by identifier.

  • year – Calendar year the entry covers.

  • amount – Amortizacion amount (non-negative Decimal).

Parameters:
asset_id: str
year: int
amount: Decimal
class AmortizacionLedger(**data)[source]

Bases: BaseModel

Per-asset yearly amortizacion already recorded.

Variables:
  • entries – Tuple of immutable AmortizacionEntry rows.

  • schema_version – Forward-compatible schema version. "1".

Parameters:
entries: tuple[AmortizacionEntry, ...]
schema_version: str
class AssetsLedgerDocument(**data)[source]

Bases: BaseModel

JSON document containing the asset ledger.

Variables:
  • schema_version – Forward-compatible schema version. "1".

  • assets – Tuple of AssetRecord rows.

Parameters:
schema_version: str
assets: tuple[AssetRecord, ...]