aeat.application.ledger._actions_manual module

Manual ledger transaction services and read projections.

The services build Transaction records from ManualLedgerTransactionCommand, persist them in a loaded TransactionCatalogue, append bucket events, and return ManualLedgerTransactionResult values. Evidence paths validate purchase-invoice, attachment, and UsageRatioProfile references before persistence.

create_manual_transaction(command, *, transaction_repository=None, bucket_event_repository=None, invoice_repository=None, attachment_store=None, usage_ratio_profile=None, occurred_at=None)[source]

Persist one manual ledger transaction in the command’s bucket.

Returns a ManualLedgerTransactionResult with the created transaction and associated bucket event.

Return type:

ManualLedgerTransactionResult

Parameters:
attach_manual_transaction_evidence(*, bucket_id, transaction_id, actor, purchase_invoice_evidence_id=None, attachment_ids=(), source_command='aeat app ledger attach', transaction_repository=None, bucket_event_repository=None, invoice_repository=None, attachment_store=None, usage_ratio_profile=None, work_unit_repository=None, calculation_repository=None, occurred_at=None)[source]

Attach purchase evidence or supplementary attachments to one ledger transaction.

Returns a ManualLedgerTransactionResult.

Return type:

ManualLedgerTransactionResult

Parameters:
get_manual_transaction(*, bucket_id, transaction_id, transaction_repository=None)[source]

Return one ManualLedgerTransactionResult from a bucket catalogue.

Return type:

ManualLedgerTransactionResult

Parameters:
list_manual_transactions(*, bucket_id, transaction_repository=None)[source]

Return every transaction in a bucket, sorted by effective date and id.

Each element is a ManualLedgerTransactionResult for one stored transaction.

Return type:

tuple[ManualLedgerTransactionResult, ...]

Parameters:
query_ledger_review_rows(query, *, transaction_repository=None, bucket_event_repository=None)[source]

Return review rows for bucket-local ledger transactions.

Returns a LedgerReviewQueryResult.

Return type:

LedgerReviewQueryResult

Parameters:
ledger_transaction_payload(transaction)[source]

Return the LedgerTransactionPayload for one ledger transaction.

Return type:

LedgerTransactionPayload

Parameters:

transaction (Transaction)

ledger_transaction_review_payload(transaction)[source]

Return one ledger transaction projection plus derived operator review status.

Returns a LedgerTransactionReviewPayload with all operator-facing fields populated from the transaction record.

Return type:

LedgerTransactionReviewPayload

Parameters:

transaction (Transaction)

ledger_transaction_result_payload(result)[source]

Return the canonical result payload for one ledger mutation/read result.

Returns a LedgerTransactionResultPayload.

Return type:

LedgerTransactionResultPayload

Parameters:

result (ManualLedgerTransactionResult)

ledger_transaction_tracking_payload(transaction)[source]

Return durable event lineage fields for one ledger transaction.

Returns a LedgerTransactionTrackingPayload.

Return type:

LedgerTransactionTrackingPayload

Parameters:

transaction (Transaction)

summarize_manual_transactions(*, bucket_id, period=None, transaction_repository=None)[source]

Return a read-only LedgerStatusReport for one bucket.

Return type:

LedgerStatusReport

Parameters:
update_manual_transaction(*, transaction_id, command, transaction_repository=None, bucket_event_repository=None, invoice_repository=None, attachment_store=None, usage_ratio_profile=None, work_unit_repository=None, calculation_repository=None, occurred_at=None)[source]

Replace one manual ledger transaction from a validated command payload.

The replacement is built from ManualLedgerTransactionCommand and saved as a new Transaction revision.

Returns a ManualLedgerTransactionResult.

Return type:

ManualLedgerTransactionResult

Parameters:
update_manual_transaction_fields(*, bucket_id, transaction_id, patch, actor, source_command, classified_by_override=None, reaffirm=False, transaction_repository=None, bucket_event_repository=None, invoice_repository=None, attachment_store=None, usage_ratio_profile=None, work_unit_repository=None, calculation_repository=None, occurred_at=None, _preloaded_catalogue=None)[source]

Apply a typed field patch to one active bucket-scoped ledger transaction.

The patch is a ManualLedgerTransactionPatch converted into a ManualLedgerTransactionCommand before the same replacement path used by update_manual_transaction().

When reaffirm is True the automatic re-affirmation no-op guard is bypassed and the command is forced through even if the patched fields are field-for-field identical to the stored transaction. This is the explicit operator-driven counterpart to the automatic silent no-op (S14).

_preloaded_catalogue is an internal optimisation: a caller that has already decrypted the bucket TransactionCatalogue (e.g. attach_manual_transaction_evidence()) passes it through so this function does not decrypt the whole catalogue a second time. There is no write between the caller’s load and this one, so the preloaded view is current.

Returns a ManualLedgerTransactionResult reflecting the updated transaction state after the patch is applied.

Return type:

ManualLedgerTransactionResult

Parameters: