cadrumo.application.calculations.foreign_asset_redeclaration module¶
Foreign-asset re-declaration advisory helpers for Modelo 720.
Every projection here reads a persisted CalculationRevision against the
registry’s ModeloRevision for the same filing context, and emits its
result as CasillaObservation rows so the advisory carries the same
per-casilla grounding the rest of the calculation chain does.
See also
foreign_asset_thresholdsResolves the per-bloque declaration floors and re-declaration deltas from the effective registry revision.
RegistryModeloObservationRegistry-grounded observation envelope accepted as prior, current, and current-declaration evidence.
application.calculations.tests.test_modelo_720_prior_year_baseline_fidelityExercises the Modelo 720 prior-year baseline advisory path with real observations across two filing years.
- modelo_720_redeclaration_advisory_findings(*, prior_observation, current_observation, current_declaration_observation=None, operation)[source]¶
Return non-blocking M720 re-declaration advisories for omitted grown groups.
current_observationis the operator’s current-year valuation evidence;current_declaration_observationis the current filed/declarable row set. When omitted, the current evidence is also treated as the current declaration, so a correctly present row produces no advisory.See also
foreign_asset_declaration_thresholds()Supplies the strict per-obligation-block re-declaration delta.
- Return type:
- Parameters:
prior_observation (RegistryModeloObservation)
current_observation (RegistryModeloObservation)
current_declaration_observation (RegistryModeloObservation | None)
operation (PinnedAuthorityOperation)
- modelo_720_declared_observation(*, revision, modelo_revision, filing_year, period, operation)[source]¶
Project what the operator actually DECLARED on a Modelo 720 draft.
The declared set is read from
input_values_by_casilla_id— the operator-supplied inputs — and deliberately NOT fromcasilla_values. The engine materialises every declared casilla incasilla_values, emitting0for a valuation the operator never supplied; a declared set derived from that mapping would therefore always contain all three obligation blocks, and the omitted-position test inmodelo_720_redeclaration_advisory_findings()could never be satisfied. An operator-entered zero remains a genuine declaration and is kept.Returns a
RegistryModeloObservationcarrying only the valuation casillas present in the operator’s input set.- Parameters:
revision (
CalculationRevision) – The persistedCalculationRevisionwhose operator inputs are read as the declaration.modelo_revision (
ModeloRevision) – TheModeloRevisionsupplying each valuation casilla’s legal and source grounding.filing_year (
int) – Devengo year the observation is stamped with.period (
str) – Registry period token the observation is stamped with.operation (
PinnedAuthorityOperation) – The caller-owned generation-pinned authority operation used for the selected foreign-asset declarations.
- Return type:
See also
modelo_720_evidence_observation()The independent valuation counterpart this declaration is tested against.
- modelo_720_evidence_observation(*, revision, modelo_revision, filing_year, period, operation)[source]¶
Project the per-asset-row valuation EVIDENCE on a Modelo 720 draft.
Joins the revision’s persisted
row_binding_valuesfor the twoforeign_assetrow bindings that carry the asset class clave and the row valuation, resolves each clave to its RGAT obligation bloque, and sums the rows per bloque onto that bloque’s valuation casilla.This is independent of what the operator typed into the declaration: the rows come from the foreign-asset source mesh, the declaration comes from the operator’s manual inputs. That independence is what makes the omitted position detectable at all.
The two binding ids are discovered from
modelo_revisionby their selectorrow_fieldrather than hardcoded, so a registry rename does not silently empty the evidence side.Returns an empty observation when the revision carries no asset rows.
- Parameters:
revision (
CalculationRevision) – The persistedCalculationRevisionwhoserow_binding_valuescarry the per-asset rows.modelo_revision (
ModeloRevision) – TheModeloRevisionthe twoforeign_assetrow bindings are discovered from by selector.filing_year (
int) – Devengo year the observation is stamped with.period (
str) – Registry period token the observation is stamped with.operation (
PinnedAuthorityOperation) – The caller-owned generation-pinned authority operation used for the selected foreign-asset declarations.
- Return type:
- modelo_720_prior_baseline_observation(*, binding_values, modelo_revision, filing_year, period, operation)[source]¶
Project the prior-year declared baseline resolved by the previous-filing carry.
binding_valuesis the resolved mapping produced byresolve_bindings_from_local_store(), which has already re-confirmed each carried observation’s stamped revision against the law-determined revision for its source context. Only theprevious_filingbindings whose selector names a Modelo 720 valuation casilla are projected; every other resolved binding is ignored.Returns an empty observation when no prior baseline resolved, which leaves the re-declaration advisory silent rather than comparing against a fabricated zero baseline.
- Parameters:
binding_values (
Mapping[str,Decimal]) – Resolvedprevious_filingbinding values, already revision-confirmed against their source context.modelo_revision (
ModeloRevision) – TheModeloRevisionsupplying each projected casilla’s legal and source grounding.filing_year (
int) – Devengo year the observation is stamped with.period (
str) – Registry period token the observation is stamped with.operation (
PinnedAuthorityOperation) – The caller-owned generation-pinned authority operation used for the selected foreign-asset declarations.
- Return type: