aeat.application.invoices._projection module¶
Application projections for invoice review and matching surfaces.
project_invoice_reviews() accepts an InvoiceCatalogue and
returns one InvoiceReviewProjection per invoice that satisfies the
supplied filter spec. The match projection cross-references an
InvoiceCatalogue against a TransactionCatalogue to
surface payment linkage.
- class InvoiceReviewProjection(**data)[source]¶
Bases:
BaseModelRendered invoice row computed by backend review services.
- Parameters:
- id: str¶
- kind: str¶
- issued_at: str | None¶
- base: str¶
- iva: str¶
- status: str¶
- payment: str | None¶
- payment_id: str | None¶
- review: InvoiceReviewRecord | None¶
- class InvoiceMatchRow(**data)[source]¶
Bases:
BaseModelOne invoice row in an
InvoiceMatchProjection.paymentcarries the matched transaction id; it isNonefor an unmatched invoice.- invoice: str¶
- payment: str | None¶
- class InvoiceMatchProjection(**data)[source]¶
Bases:
BaseModelBackend-owned invoice/payment matching projection.
- Parameters:
period (Period)
matched (tuple[InvoiceMatchRow, ...])
unmatched (tuple[InvoiceMatchRow, ...])
- period: Period¶
- matched: tuple[InvoiceMatchRow, ...]¶
- unmatched: tuple[InvoiceMatchRow, ...]¶
- project_invoice_reviews(catalogue, state, *, spec, invoice_id=None)[source]¶
Return backend-computed
InvoiceReviewProjectionrows for invoices matchingspec.- Parameters:
catalogue (
InvoiceCatalogue) – TheInvoiceCataloguewhose invoices are projected.state (
WorkflowState) – The workflow state carrying invoice review records.spec (
InvoiceReviewFilterSpec) – Filter spec controlling which invoices are included.invoice_id (
str|None) – When set, restricts output to that single invoice.
- Return type:
- project_invoice_review(invoice, review)[source]¶
Return the backend-owned
InvoiceReviewProjectionfor one invoice.- Return type:
- Parameters:
invoice (Invoice)
review (InvoiceReviewRecord | None)
- invoice_display_amounts(invoice, review)[source]¶
Compute review-adjusted base and IVA display totals.
- invoice_review_status(invoice, review)[source]¶
Return the backend-owned
InvoiceReviewStatusfor the invoice.- Return type:
- Parameters:
invoice (Invoice)
review (InvoiceReviewRecord | None)
- apply_manual_invoice_match(state, invoice_id, ledger_id)[source]¶
Return the updated
WorkflowStatewith a manual invoice/payment match recorded.- Return type:
- Parameters:
state (WorkflowState)
invoice_id (str)
ledger_id (str)
- project_invoice_payment_matches(*, period, catalogue, transactions, state)[source]¶
Return period-labelled invoice/payment match status.
- Parameters:
period (
Period) – Filing period embedded in the returned projection.catalogue (
InvoiceCatalogue) – TheInvoiceCataloguewhose invoices are matched.transactions (
TransactionCatalogue) – TheTransactionCataloguecross-referenced for payment linkage.state (
WorkflowState) – The workflow state carrying invoice review records.
- Return type:
Returns an
InvoiceMatchProjectionwith matched and unmatched rows for the given period.