aeat.application.aggregation._business_proportion module¶
Shared BUSINESS / MIXED business-proportion dispatch.
Centralises business proportion dispatch: four aggregation sites
(_iva_ledger, _renta_ledger, _renta_income_ledger,
and _renta_gasto_ledger) each carry the
same dispatch shape:
if classification is BusinessClassification.BUSINESS:
return Decimal("1") # or the unit-scaled amount
if classification is BusinessClassification.MIXED:
assert business_pct is not None
return business_pct # or amount * business_pct
return None
This module centralises the proportion lookup so every call site uses one canonical mapping; the per-site multiplication into an amount stays local because the unit semantics differ (IVA ledger returns a bare proportion; renta sites return amount * proportion).
- business_proportion(classification, business_pct)[source]¶
Return the BUSINESS / MIXED dispatch proportion, or
None.BUSINESS→Decimal("1")(the whole row is deductible / business-attributable).MIXEDwith abusiness_pctset →business_pct.MIXEDwithbusiness_pct=None→None(caller treats as not-yet-classified;preflightsurfaces the gap separately viaMISSING_PROPORTIONALITY_REFERENCE).Any other classification (e.g.
PERSONAL,NOT_YET_PROCESSED) →None.
- Return type:
- Parameters:
classification (BusinessClassification)
business_pct (Decimal | None)