Stock Value Flow Layer Tracking
Tracks quantities and values transferred between stock valuation layers. The stock.valuation.layer.tracking model links source and destination layers and exposes their related stock moves.
Dependencies and access
Dependencies are stock_account_product_run_fifo_hook and sale; the manifest excludes stock_valuation_layer_usage.
Internal users can read tracking records. Settings administrators can create, edit, and delete them. A global rule limits normal access to allowed companies. Automatic tracking creation and cleanup use elevated operations.
Current behavior
Valuation-layer creation records FIFO consumption supplied through taken_data context.
For positive layers without that data, upstream stock moves are traversed without revisiting moves, and same-company outgoing layers are considered in creation-date order.
Writes with taken_data context append tracking only when quantity/value state changes. Replaying the same applied write or changing unrelated metadata does not add duplicate allocations. Distinct FIFO increments remain additive, even when their amounts are identical.
Dropship valuation matches newly created positive and negative layers within each move, company, and lot. It supports multiple lots and split layers, preserves source-value rounding totals, and populates stock-move links. Unequal two-sided quantities log a nonblocking mismatch diagnostic using record IDs and quantities. Empty or one-sided groups do not produce warnings.
Valuation layers show totals taken from and given to other layers, while stock moves indicate whether source/target links exist.
A constraint rejects using the same layer as both source and destination.
Rebuilding tracking
Administrators can select product variants and run PMIS Rebuild FIFO tracking data from the Action menu.
This deletes existing source tracking for the selected products' layers and reconstructs links by matching outgoing quantities against incoming layers in creation-date FIFO order, with layer IDs breaking timestamp ties. Values use each source layer's average unit value and currency rounding. Zero-quantity tracking rows are cleaned up.
The rebuild changes tracking data, not stock quantities or accounting entries. It is a reconstruction, not a replay of every original warehouse decision. Review company scope and preserve required audit evidence before running it.
The rebuild processes each allowed company's layers separately, including when called with elevated access. Companies outside the allowed scope are left unchanged. Rebuilt links populate both valuation-layer references and the target stock-move field, restoring stock-move navigation when a move exists.
An incoming layer need not predate the outgoing layer it supplies. This preserves later-receipt matching for negative stock; it is not evidence that stock was physically available at the time of the issue. If receipts are insufficient, only the available quantity is linked. Review unmatched outgoing quantities.
Assisted dropship tracking repair
Settings administrators can select valuation layers and open Repair Dropship Tracking from the valuation-layer list or form's Action menu. Normal access to the selected layers and tracking records, including layer write permission, is also required. This wizard repairs tracking only, not stock or accounting.
Select the exact positive and negative layers for a known dropship valuation operation. Use one allowed company and completed dropship or dropship-return moves. Do not combine historical correction batches merely because they share a move or lot; the original batch cannot be inferred automatically.
Click Preview Repair. Review the selected layers, existing links, proposed quantity/value allocations, and unmatched quantities. Preserve any required audit evidence before applying: the selected old links will be replaced.
If needed, use Change Selection and preview again. Links crossing the selected source/destination boundary block the repair, including hidden cross-company links. Resolve these manually rather than expanding scope without evidence. Incoming-layer links from upstream return flows are not replaced by this dropship-pair repair.
Check I verified the selected valuation operation and repair scope, then click Apply Reviewed Repair and confirm the replacement.
The wizard uses the same matching and rounding policy as normal dropship tracking. It can replace duplicate/wrong allocations, fill missing pairs, and restore target-move links within the reviewed scope. It leaves unmatched quantities untracked; it cannot correct an underlying quantity discrepancy.
Application locks the scope and rechecks the preview. Changed inputs or tracking require a fresh preview; a busy scope produces a retry message. Failures roll back the replacement, and an applied wizard cannot run twice. Transient preview rows are never trusted as repair instructions: the server recomputes the plan. Selected layers' native modification timestamps advance for concurrency control, but their quantities, valuation amounts, and journal entries do not change. Other tracking remains untouched.
Upgrade the module normally to register the transient wizard models and action. No migration script, automatic repair, or historical deduplication runs during that upgrade. The existing product FIFO rebuild remains a separate, broader operation; it is not invoked by this wizard.
FIFO tracking diagnostics
Settings administrators with normal read access can open FIFO Tracking Diagnostics from Inventory's Reporting menu or the product-variant list or form's Action menu. Choose one allowed company and optionally select products; leave the product selection empty for a company-wide scan. Only products using FIFO in that company currently are included, including archived products with valuation history. There is no date filter: historical allocations are needed to assess a layer's full coverage.
Click Scan FIFO Tracking to list review flags by product and valuation layer. Checks cover unmatched outgoing quantities, source/outgoing overallocation, negative allocations, invalid link endpoints or target-move navigation, repeated identical allocations, and outgoing value differences where quantity coverage is complete. Quantities use product unit-of-measure rounding and values use company-currency rounding.
Open a finding to inspect its tracking links, or click Open Layers to open its valuation evidence. Open Findings opens a product-grouped list with normal filtering/export facilities to preserve evidence before deciding on a repair. Repeated equal amounts may be legitimate increments on separate state transitions. Pending negative stock, returns, revaluations, and rounding can explain review flags; they are not automatic repair instructions. The tool does not simulate historical FIFO order, infer historical costing methods, or reconcile journal entries.
Scans write only temporary wizard results, never valuation layers, tracking, stock, or accounting. Results are snapshots; rescan after changing the scope or underlying data. Normal record rules apply, and only visible links in the selected company are checked; this is not a complete cross-company integrity audit. Each scan is limited to 20,000 layers, 40,000 links, and 10,000 review flags. Larger histories require narrower product selections; limits block rather than silently truncate the results. No automatic repair or FIFO rebuild is invoked. Use the separate dropship repair wizard only for verified dropship scopes, or review the broader product rebuild separately. Upgrade normally to register this tool; no historical data migration or repair runs on upgrade.
Limitations
Empty or one-sided dropship layer groups produce no tracking links. When two-sided quantities differ at the product unit-of-measure rounding precision, the hook logs a nonblocking mismatch diagnostic. Only the matched quantity is linked; the hook does not invent counterparts or search historical layers for a match. The repair wizard reports unmatched quantities but cannot correct the underlying stock or valuation discrepancy.
Context-write replay protection uses the layer's actual quantity/value state transition, not a persisted operation ID. It does not treat identical amounts on distinct state transitions as duplicates or remove historical duplicates. Tracking creation and writes enforce company consistency for source/destination layers and the target stock move, including elevated calls.
No migration or automatic data repair runs on upgrade. Existing tracking is left unchanged unless explicitly repaired or rebuilt. Repair Dropship Tracking lets authorized Settings administrators preview and replace links for explicitly selected completed dropship layers, including historical duplicates within that scope. It cannot infer historical valuation batches; review the operation and preserve required audit evidence before confirming. Links crossing the selected scope block repair, and unmatched quantities remain untracked. The broader product FIFO rebuild is a separate operation.
Bug Tracker
Bugs are tracked on PMISuite Repository Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback.
Credits
Contributors
Matjaž Mozetič
Maintainers
Current maintainer:
Luxim is an independent R&D and deployment company focused on solving complex problems in the Odoo ecosystem.
Luxim is an active member of OCA (Odoo Community Association).






