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_thresholds

Resolves the per-bloque declaration floors and re-declaration deltas from the effective registry revision.

RegistryModeloObservation

Registry-grounded observation envelope accepted as prior, current, and current-declaration evidence.

application.calculations.tests.test_modelo_720_prior_year_baseline_fidelity

Exercises 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_observation is the operator’s current-year valuation evidence; current_declaration_observation is 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:

tuple[ModeloVerificationFinding, ...]

Parameters:
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 from casilla_values. The engine materialises every declared casilla in casilla_values, emitting 0 for 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 in modelo_720_redeclaration_advisory_findings() could never be satisfied. An operator-entered zero remains a genuine declaration and is kept.

Returns a RegistryModeloObservation carrying only the valuation casillas present in the operator’s input set.

Parameters:
  • revision (CalculationRevision) – The persisted CalculationRevision whose operator inputs are read as the declaration.

  • modelo_revision (ModeloRevision) – The ModeloRevision supplying 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:

RegistryModeloObservation

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_values for the two foreign_asset row 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_revision by their selector row_field rather 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 persisted CalculationRevision whose row_binding_values carry the per-asset rows.

  • modelo_revision (ModeloRevision) – The ModeloRevision the two foreign_asset row 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:

RegistryModeloObservation

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_values is the resolved mapping produced by resolve_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 the previous_filing bindings 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]) – Resolved previous_filing binding values, already revision-confirmed against their source context.

  • modelo_revision (ModeloRevision) – The ModeloRevision supplying 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:

RegistryModeloObservation