aeat.application.prorrata_register._seed module

Seed the cross-period prorrata register from stamped prior observations.

The LIVA art. 105.Uno normal provisional percentage is the prior ejercicio’s definitive prorrata. This module locates that percentage in the prior Modelo 303 settlement observation and trusts it only after the observation’s registry revision stamp re-confirms against the law-determined revision for the source period.

See also

ProrrataRegisterEntry

Register record populated with the carried-prior-definitive percentage, provenance, and source-observation identity.

ProrrataProvisionalProvenance

Closed provenance axis whose CARRIED_PRIOR_DEFINITIVA member marks the normal LIVA art. 105.Uno seed path.

CalculationObservationRepository

Local observation catalogue scanned for prior Modelo 303 settlement observations.

select_revision()

Law-determined revision resolver used to re-confirm the stored stamped_revision_id before trusting the carry.

CrossPeriodCleanStateBlocker

Blocker vocabulary reused for revision-divergent seed findings.

class ProrrataPriorDefinitivaSeed(entry, source_modelo, source_filing_year, source_period, source_casilla_id, stamped_revision_id)[source]

Bases: object

A re-confirmed prior-year definitive percentage ready to seed the register.

Parameters:
entry: ProrrataRegisterEntry
source_modelo: str
source_filing_year: int
source_period: str
source_casilla_id: TypeAliasType
stamped_revision_id: str | None
class ProrrataSeedFinding(code, blocking, message, source_modelo, source_filing_year, source_period, stamped_revision_id, selected_revision_id)[source]

Bases: object

Operator-visible seed/cross-check blocker or advisory.

Parameters:
  • code (str)

  • blocking (bool)

  • message (str)

  • source_modelo (str)

  • source_filing_year (int)

  • source_period (str)

  • stamped_revision_id (str | None)

  • selected_revision_id (str | None)

code: str
blocking: bool
message: str
source_modelo: str
source_filing_year: int
source_period: str
stamped_revision_id: str | None
selected_revision_id: str | None
property advisory: bool

Whether this finding is a non-blocking advisory.

class ProrrataPriorDefinitivaSeedEvaluation(seed, findings=())[source]

Bases: object

Seed resolution plus any blockers or advisories surfaced while resolving it.

Parameters:
seed: ProrrataPriorDefinitivaSeed | None
findings: tuple[ProrrataSeedFinding, ...]
property blocked: bool

Whether any finding blocks trusting the seed.

evaluate_carried_prior_definitiva_seed(*, ejercicio, observation_repository=None, sector_id=None)[source]

Evaluate the carried-prior-definitive seed and surface blocker/advisory findings.

Divergent or unreconfirmable revision stamps produce a blocking registry_revision_divergence finding and no seed. A missing legacy stamp is a non-blocking advisory: the prior observation can seed the register, but the operator-visible finding records that the legacy source could not be re-confirmed.

Return type:

ProrrataPriorDefinitivaSeedEvaluation

Parameters:
seed_carried_prior_definitiva_entry(*, ejercicio, observation_repository=None, sector_id=None)[source]

Build a carried-prior-definitive register entry from a stamped prior observation.

The seed is available only when the prior ejercicio has a Modelo 303 settlement-period observation carrying iva.prorrata-porcentaje and that observation’s stamped_revision_id still matches the law-determined revision selected for its source (M303, ejercicio - 1, settlement period). Divergent or unreconfirmable observations are not trusted. Call evaluate_carried_prior_definitiva_seed() when the caller needs the operator-facing blocker/advisory findings that explain why a seed did or did not resolve.

Parameters:
  • ejercicio (int) – Ejercicio whose provisional prorrata entry is being seeded.

  • observation_repository (CalculationObservationRepository | None) – Observation repository to scan. Defaults to the active runtime repository.

  • sector_id (str | None) – Optional sector axis for future sectores-diferenciados entries. None seeds the whole-entity register entry.

Return type:

ProrrataPriorDefinitivaSeed | None

Returns:

A ProrrataPriorDefinitivaSeed when a stamped prior settlement observation re-confirms, otherwise None.

cross_check_prorrata_entry_against_prior_observation(entry, *, observation_repository=None)[source]

Cross-check a register entry against the prior definitive observation.

A carried-prior-definitive entry must match the prior Modelo 303 settlement observation because art. 105.Uno is the normal carry rule. AEAT-authorised and inicio-de-actividades entries are regulated alternatives: when they differ from the prior definitive, the difference is surfaced as a non-blocking notice that names the provenance rather than being silenced.

Return type:

tuple[ProrrataSeedFinding, ...]

Parameters: