aeat.application.modelo._work_create_policy module¶
Application policies for creating modelo work units.
The work-create command runs these guards before provisioning a work unit. They cover three distinct policy surfaces: modelo codes that are still stub-only in the local work-unit flow, modelos that do not apply to the active profile’s taxpayer model, and active profiles whose CCAA points at a foral tax regime.
Stub-only checks are locale-key lookups over Modelo members and a few
registry-known numeric forms. Applicability checks derive a profile projection
from the active workflow state, then ask the registry-owned applicability rules
whether the requested modelo is excluded. The foral check delegates to the
canonical tax-region parser so the CLI renders the same refusal text as profile
setup. Once these CLI policy guards pass,
aeat.application.modelo.create_work_unit() performs the application
readiness and registry revision checks before inserting the
aeat.domain.modelos.WorkUnit.
See also
aeat.entrypoints.cli._modelo_work_lifecycle_cli:Calls these guards from
app modelo work create.aeat.domain.calculations.registry.derive_modelo_applicability():Registry-owned modelo applicability classifier used by this guard.
aeat.domain.contribuyente.parse_tax_region():Canonical CCAA parser that raises foral-regime refusals.
- CEDED_AUTONOMIC_MODELO_LOCALE_KEYS: dict[str, str]¶
Ceded autonomic-tax modelos that are administered by the Comunidades Autónomas rather than the AEAT, and are therefore absent from the calculation registry entirely: ITP-AJD (
600,620) and ISD (650,660) are tributos cedidos. A registry discovery lookup for one of these codes must redirect the operator to the competent regional Hacienda / CCAA instead of surfacing a generic not-present-in-registry error. The values reuse the work-create refusal copy, which already names the ceded tax, its enabling law, and the regional filing route in every locale.
- ceded_autonomic_modelo_locale_key(modelo)[source]¶
Return the instructive autonomic-redirect locale key for a ceded modelo.
ITP-AJD (
600/620) and ISD (650/660) are ceded autonomic taxes administered by the Comunidades Autónomas, not AEAT modelos present in the calculation registry. Discovery surfaces (describe/casillas/formulas) must redirect an operator who references one of these codes to the competent regional Hacienda / CCAA rather than surface a generic not-present error. Whitespace is normalised;Noneis returned for any other modelo, including registry-backed and genuinely unknown codes.See also
modelo_work_create_refusal_locale_key():The sibling work-create refusal this discovery redirect mirrors.
- class ModeloWorkCreateApplicabilityRefusal(modelo, reason)[source]¶
Bases:
objectApplication refusal for a modelo the active profile should not file.
modelois the stripped requested modelo code.reasonis the registry-derived applicability reason surfaced by the CLI together with its--allow-not-applicableescape hatch.
- modelo_work_create_refusal_locale_key(modelo)[source]¶
Return the locale key for a refused stub-modelo create request.
The lookup normalises whitespace and returns
Nonewhen the modelo is not inSTUB_ONLY_MODELOS. Modelo 210 is conditionally released when theaeat_m210_engine_livesetting is enabled; all other entries remain refused by this policy surface.See also
aeat.core.Modelo:Closed modelo enum used for the core stub-only entries.
aeat.entrypoints.cli._modelo_work_lifecycle_cli:Converts the locale key into a typed CLI refusal.
- modelo_work_create_applicability_refusal(modelo, *, allow_not_applicable)[source]¶
Return an applicability refusal for the active profile, if one applies.
When
allow_not_applicableis true, the guard deliberately returnsNoneso the CLI can provision the work unit and record that the operator bypassed the applicability guard. Otherwise the active profile record is projected intoaeat.domain.deadlines.TaxpayerProfilefacts and checked against the registry-owned applicability rules. OnlyNOT_APPLICABLEandATTRIBUTION_PASS_THROUGHverdicts block creation.- Return type:
- Returns:
A
ModeloWorkCreateApplicabilityRefusalfor a blocking verdict, orNonewhen the modelo is applicable, unsupported by an explicit rule, or deliberately bypassed.- Parameters:
See also
aeat.domain.calculations.registry.derive_modelo_applicability():Registry-owned applicability classifier used by this guard.
aeat.application.user_profile.projection_for_taxpayer():Builds the taxpayer profile consumed by the classifier.
- guard_active_profile_foral_ccaa()[source]¶
Raise the canonical foral-regime refusal for the active profile, if present.
The guard reads
tax_residence.ccaafrom the active profile and delegates toaeat.domain.contribuyente.parse_tax_region(). Common-regime CCAA values pass through; foral values raise the domain refusal before work-unit creation reaches the generic unsupported-modelo checks.- Return type: