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: BaseModel

Rendered 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: BaseModel

One invoice row in an InvoiceMatchProjection.

payment carries the matched transaction id; it is None for an unmatched invoice.

Parameters:
  • invoice (str)

  • payment (str | None)

invoice: str
payment: str | None
class InvoiceMatchProjection(**data)[source]

Bases: BaseModel

Backend-owned invoice/payment matching projection.

Parameters:
period: Period
matched: tuple[InvoiceMatchRow, ...]
unmatched: tuple[InvoiceMatchRow, ...]
project_invoice_reviews(catalogue, state, *, spec, invoice_id=None)[source]

Return backend-computed InvoiceReviewProjection rows for invoices matching spec.

Parameters:
Return type:

tuple[InvoiceReviewProjection, ...]

project_invoice_review(invoice, review)[source]

Return the backend-owned InvoiceReviewProjection for one invoice.

Return type:

InvoiceReviewProjection

Parameters:
invoice_display_amounts(invoice, review)[source]

Compute review-adjusted base and IVA display totals.

Return type:

tuple[Decimal | None, Decimal | None]

Parameters:
invoice_review_status(invoice, review)[source]

Return the backend-owned InvoiceReviewStatus for the invoice.

Return type:

InvoiceReviewStatus

Parameters:
apply_manual_invoice_match(state, invoice_id, ledger_id)[source]

Return the updated WorkflowState with a manual invoice/payment match recorded.

Return type:

WorkflowState

Parameters:
project_invoice_payment_matches(*, period, catalogue, transactions, state)[source]

Return period-labelled invoice/payment match status.

Parameters:
Return type:

InvoiceMatchProjection

Returns an InvoiceMatchProjection with matched and unmatched rows for the given period.