cadrumo.domain.contribuyente.inventory.valuation module¶
Inventory valuation and Anexo D projection engines.
This module owns calculations over the canonical inventory records.
Record shapes remain in records; callers import each calculation
directly from this module.
- derive_inventory_anexo_d_values(ledger)[source]¶
Derive every public projection field from one retained canonical source.
- Return type:
_InventoryAnexoDDerivation- Parameters:
ledger (InventoryLedger)
- compute_inventory_anexo_d_projection(ledger)[source]¶
Project one complete applicable activity ledger to inventory casillas.
- Return type:
- Parameters:
ledger (InventoryLedger)
- compute_inventory_valuation(ledger)[source]¶
Value closing stock and COGS using the ledger’s valuation method.
Dispatches to the FIFO or weighted-average implementation per
InventoryLedger.valuation_method.- Parameters:
ledger (
InventoryLedger) – Ledger to value.- Return type:
- Returns:
InventoryValuationResultcarrying the closing layers, closing valuation, COGS, and purchase totals.- Raises:
InventoryLedgerError – When
valuation_methodis not supported (defence-in-depth — should be unreachable as LIFO is rejected at parse time).
- layers_value(layers)[source]¶
Return the total value of
layers, summing quantity times unit cost.- Return type:
- Parameters:
layers (tuple[StockLayer, ...] | list[StockLayer])
- inventory_acquisition_fingerprint(movement)[source]¶
Return a deterministic versioned economic/evidence purchase fingerprint.
- Return type:
TypeAliasType- Parameters:
movement (MovementRecord)