cadrumo.domain.iva.place_of_supply module¶
Which provision places an operation, and whether it fixes the supply’s nature.
The classification rules decide WHERE an operation is located and therefore how it is treated. Until now they carried none of the law that establishes those decisions: the predicates encoded the conditions in Python and the regulatory content – which article places the operation, and whether that article speaks to goods or to services – existed nowhere. A predicate is logic and belongs in Python; the provision behind it is regulatory content, versioned by filing year, and belongs in the registry.
The goods/services fork is why this is not the per-category table. LIVA art.
68 locates entregas de bienes; arts. 69 and 70 locate prestaciones de
servicios. On a cross-border branch the same two parties, the same amount and
the same day are placed by different articles and can reach different treatments.
Several rules share one category while resting on different provisions – three
separate reverse-charge rules all resolve to DOMESTIC_REVERSE_CHARGE – so a
table keyed by category cannot express what establishes each one.
An absent nature is a finding, not a blank. A rule whose provisions do not fix
whether goods or services were supplied omits supply_nature, and that omission
means the articles are silent. It never means the row is unfinished. The worked
case is the Union scheme: LIVA art. 163 unvicies reaches “presten servicios”
and “ventas a distancia intracomunitarias de bienes”, so citing it alone
determines nothing – the goods rules that ride it are fixed by art. 68 instead,
and the services rule by art. 69.
The domestic rules omit it deliberately. Both placement rules put a domestic operation in the same territory, so its treatment is settled by the rate tier rather than by what was supplied. Demanding the distinction there would refuse invoices for a fact their own treatment ignores, which is the laziness property the supply-nature axis exists to keep.
Refusal rather than a guess. place_of_supply_rule() raises for a rule
with no row, and carries a supply_nature of None for a rule whose
provisions are silent. Neither substitutes a default; a caller that cannot
determine the placement is expected to say so, and the two conditions stay
distinguishable – an ungrounded rule raises where a silent one answers.
See also
IvaCategoryThe treatments these rules resolve into.
SupplyNatureThe axis a cross-border rule’s provisions may or may not fix.
- class IvaPlaceOfSupplyRule(**data)[source]¶
Bases:
BaseModelThe legal grounding of one classification rule’s placement.
- Variables:
rule_id – The classification rule this grounds, matching the id the decision table declares. A parity gate proves the two sets are equal in both directions, so a rule cannot ship ungrounded and a row cannot outlive its rule.
supply_nature – The nature the cited provisions fix, or
Nonewhen they are silent on it.Noneis a statement about the statute.legal_references – Every provision the rule rests on, in reading order. At least one.
establishing_reference – The one provision that establishes the treatment, which must also appear in
legal_references. Citing the whole reading list leaves unanswered which article actually decides.notes – Reviewer prose in Spanish, matching the sibling catalogue.
valid_from – First date this grounding is asserted to hold. Required on a grounded row, absent on a legal-basis-exempt one.
valid_to – Last date, inclusive. Same rule.
- Parameters:
data (Any)
The window attaches to the RULE rather than to a citation because the rule is the grounding-bearing row here: its provisions are bare reference ids with no table of their own to carry a span. The bounds are closed and a gate holds them inside the intersection of the cited provisions’ effective spans.
- rule_id: str¶
- supply_nature: SupplyNature | None¶
- legal_references: tuple[str, ...]¶
- establishing_reference: str¶
- notes: str¶
- legal_basis_exempt: bool¶
- valid_from: date | None¶
- valid_to: date | None¶
- property window: ValidityWindow | None¶
Return the span this grounding is asserted over, or
Nonewhen exempt.- Returns:
The declared
ValidityWindow, orNonefor a legal-basis-exempt row, which grounds nothing and so is asserted over nothing.
- load_place_of_supply_table(*, operation)[source]¶
Adapt the published place-of-supply grounding table.
- Return type:
- Returns:
Rules keyed by rule id, each carrying the span it is asserted over.
- Parameters:
operation (PinnedAuthorityOperation)
- place_of_supply_years(*, operation)[source]¶
Return every filing year the table can be resolved for.
A year counts only when EVERY grounded rule is asserted over it. A rule whose provisions stop earlier stops the table, because a classification answered from a rule that does not apply is worse than a refusal. Legal-basis-exempt rows ground nothing and are excluded rather than treated as covering everything or nothing.
- Return type:
- Returns:
The derived set of resolvable filing years.
- Parameters:
operation (PinnedAuthorityOperation)
- place_of_supply_rule(rule_id, *, on, operation, projected_year)[source]¶
Return the grounding for
rule_idin the filing year ofon.- Parameters:
rule_id (
str) – The classification rule’s declared id.on (
date) – A date in the filing year whose table applies.operation (
PinnedAuthorityOperation) – The pinned authority operation supplying the place-of-supply table.projected_year (
int) – The filing year whose grounded rules are required.
- Returns:
The grounding row.
- Return type:
- Raises:
IvaCatalogueError – When the table grounds no such year, or carries no row for the rule, or the row is not asserted over that year. Raising is correct rather than returning a permissive default: an ungrounded placement has no provision behind it, and answering anyway would manufacture one.