cadrumo.application.invoices.source_resolver module¶
Source-mesh resolver for governed invoice records.
InvoiceCatalogueSourceResolver reads the
InvoiceCatalogue supplied through its application-owned
read capability. It projects those records into the calculation mesh as
CalculationSourceResolution values for
COLLECTIBLE_INVOICE,
PAYABLE_INVOICE, and the combined-direction
M347_THIRD_PARTY_OPERATION.
The Invoice aggregate is the sole invoice record and
the reconciliation and link authority. Records reach the mesh only once they can
be represented as registry
InvoiceObservation facts, with Modelo 349
summary bindings, detail rows, transaction ids, and source provenance emitted
through one resolver envelope.
- invoice_direction_to_source_kind(kind)[source]¶
Map an invoice direction to its settlement source kind.
The single contractual home for the direction<->settlement relationship, consumed by both
InvoiceCatalogueSourceResolverand the operatoraeat app ledger invoiceCLI. An issued invoice (we billed a customer) is collectible; a received invoice (a vendor billed us) is payable.Returns the canonical
BindingSourceKindmember rather than a locally-declared direction enum: the settlement taxonomy has exactly one home peraeat-registry-bindings.- Return type:
- Returns:
The
BindingSourceKindsettlingkind.- Parameters:
kind (InvoiceKind)
- class InvoiceCatalogueSourceResolver(*, ports)[source]¶
Bases:
objectResolve invoice-source bindings and detail rows from persisted invoice records.
The resolver owns both invoice source kinds in the calculation mesh. It filters records by
CalculationSourceContext, turns declarable intracommunity entries intoInvoiceObservationfacts, and returns aCalculationSourceResolutioncarrying binding values, Modelo 349 detail rows, linked transaction ids, and stable source provenance.- Parameters:
ports (InvoiceSourceResolverPorts)
-
owned_sources:
ClassVar[tuple[BindingSourceKind,...]]¶
- resolve(context)[source]¶
Resolve this context’s invoice-source bindings against the catalogue.
- Parameters:
context (
CalculationSourceContext) – Modelo, revision, period, and bucket selecting both the active invoice sources and the invoices in scope.- Return type:
- Returns:
The resolution carrying binding values, Modelo 349 detail rows, linked transaction ids, diagnostics, and source provenance. Sources the active revision does not declare resolve to an empty result, and a degraded catalogue read resolves to a storage-degradation result rather than a zero total.
- M349_CLAVE_INFERRED_REASON¶
Diagnostic
reasonfor a Modelo 349 clave the resolver inferred from the invoice’s IVA category because the record carried no explicit operation type.
- iva_category_for_operation_type(operation_type)[source]¶
Return the IVA treatment an operator stated by choosing a 349 clave.
- Parameters:
operation_type (
IntracomOperationType|None) – The clave the operator selected, if any.- Return type:
- Returns:
The category that clave declares, or
Nonewhen no clave was chosen. A clave outside the invoice-sourced set also yieldsNonerather than a guess: the claves reporting call-off stock movements carry no invoice, so no category can be inferred from them.