cadrumo.application.prorrata_register.election module

Which provisional prorrata percentages an operator may declare, and on what evidence.

LIVA art. 105 admits four provenances for the provisional percentage, and they do not all reach the register the same way. Three are declared by the taxpayer; the fourth is computed. Two of the three stand on a document, and the register records its reference because the percentage is only defensible with it.

Encoding that in one frontend meant a second one had to restate it, and the failure is not cosmetic: electing under a provenance the law does not admit, or recording an authorised percentage with no authorisation, produces a register entry the taxpayer cannot defend. The rules live here so both readings of art. 105 come from the same place.

class ProrrataElectionRefusal(*values)[source]

Bases: StrEnum

Why an election was refused, so a surface can say which input to fix.

PROVENANCE_NOT_ELECTABLE
REFERENCE_REQUIRED
REFERENCE_NOT_PERMITTED
exception ProrrataElectionError(refusal, message)[source]

Bases: CadrumoError

Raised when a declared election does not satisfy art. 105.

Carries the discriminated reason rather than only prose, so an interface can name the offending input instead of restating the whole rule.

Parameters:
Return type:

None

code
validate_prorrata_election(*, provenance, reference)[source]

Check one declared provenance and its reference against art. 105.

Parameters:
Return type:

tuple[ProrrataProvisionalProvenance, str | None]

Returns:

The provenance and reference as they should be recorded.

Raises:

ProrrataElectionError – When the provenance is computed rather than declarable, when a document-backed provenance carries no reference, or when a reference accompanies a provenance that has none.