cadrumo.application.bienes_inversion.declare_command module

Declaring a capital good from operator intent, rather than from a finished record.

BienesInversionRegisterService.declare takes a BienInversionIvaRecord that is already valid. Someone has to build it, and building it is not clerical: the operator supplies a disposal year and a disposal regime as two separate answers, and neither is meaningful without the other. That pairing rule lived in the CLI, which meant the register could only be added to from one surface — and a second surface adding to it would have had to restate the rule and hope it matched.

The refusal is typed rather than an interface error, because a half-declared disposal is a fact about the declaration, not about how it was typed in. The adapter maps it to its own message; a different frontend maps it differently.

exception BienInversionDisposalIncompleteError(*, missing)[source]

Bases: CadrumoError

Raised when exactly one half of a disposal was supplied.

A disposal is a year AND a regime: the year alone does not say how the remaining window is imputed, and the regime alone does not say when. The error names which half is missing so a surface can point at the right input.

Parameters:

missing (str)

Return type:

None

code
class BienInversionDeclarationCommand(**data)[source]

Bases: BaseModel

One operator’s intent to track a capital good in the register.

Parameters:

data (Any)

identifier: str
description: str
acquisition_year: NonNegativeInt
acquisition_ledger_id: str
cuota_soportada: Decimal
prorrata_inicial_pct: Decimal
kind: BienInversionKind
art108_elegible: bool
prorrata_sector_id: str | None
disposal_year: NonNegativeInt | None
disposal_regime: BienInversionDisposalRegime | None
class BienInversionDeclarationResultV1(**data)[source]

Bases: BaseModel

The persisted record and the register it now belongs to.

Parameters:

data (Any)

record: BienInversionIvaRecord
updated_register: BienesInversionIvaRegister
resolve_bien_inversion_disposal(*, disposal_year, disposal_regime)[source]

Pair a disposal year with its regime, or refuse a half-supplied one.

Parameters:
Return type:

BienInversionDisposal | None

Returns:

The disposal, or None when neither half was supplied.

Raises:

BienInversionDisposalIncompleteError – When exactly one half is present.

declare_bien_inversion(command, *, service)[source]

Build one register record from operator intent and persist it.

Parameters:
Return type:

BienInversionDeclarationResultV1

Returns:

The record as persisted, with the updated register.

Raises:

BienInversionDisposalIncompleteError – When only one half of a disposal was supplied.