Stock Account Product Run FIFO Hook
This module adds hook points in the FIFO valuation process to add more flexibility in the information that is stored and processed during FIFO candidate calculations.
In Odoo 19, the valuation logic has shifted from stock.valuation.layer to stock.move. This module provides extension points for custom modules to:
Access FIFO candidate move information during valuation
Enrich stock moves with custom candidate data
Control standard price update logic during FIFO operations
Table of contents
Usage
Add dependency of this module to your custom module:
"depends": ["stock_account_product_run_fifo_hook"],Inherit from product.product in your custom module
Override the hook methods to add custom logic:
_run_fifo_prepare_candidate_update(candidate_move, qty_taken, value_taken, valued_move=None) — Called for each FIFO candidate when it is consumed.
candidate_move: The FIFO source move being consumed
qty_taken: Quantity consumed from this candidate
value_taken: Value consumed from this candidate
valued_move: (obtained via context) The stock move being valued that is consuming this candidate
Use it to capture exact qty/value taken, create usage records, or track valuation relationships between moves.
When valued_move is Passed to Context
The valued_move is passed to context when an outgoing stock move calls _set_value() for FIFO costing:
# In stock.move._set_value() for FIFO moves:
for move in fifo_moves:
super(StockMove, move.with_context(valued_move=move))._set_value(
correction_quantity=correction_quantity
)
This happens when:
An outgoing stock move (customer delivery, internal transfer, etc.) is being valued
The product uses FIFO costing method
The system needs to consume FIFO candidates to determine the move’s valuation
During this process:
_run_fifo() is called to calculate the unit cost
For each FIFO candidate consumed, _run_fifo_prepare_candidate_update() hook is called
The valued_move (the move being valued) is available in context
You can use it to link the candidate to the move being valued
Bug Tracker
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.
Do not contact contributors directly about support or help with technical issues.
Credits
Contributors
Forgeflow (https://www.forgeflow.com)
Jordi Ballester Alomar <jordi.ballester@forgeflow.com>
Jasmin Solanki <jasmin.solanki@forgeflow.com>
Maintainers
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
This module is part of the OCA/stock-logistics-workflow project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Release files for odoo-addon-stock-account-product-run-fifo-hook 19.0.1.0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| odoo_addon_stock_account_product_run_fifo_hook-19.0.1.0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Release files / odoo_addon_stock_account_product_run_fifo_hook-19.0.1.0.0.2-py3-none-any.whl
| Download URL | odoo_addon_stock_account_product_run_fifo_hook-19.0.1.0.0.2-py3-none-any.whl |
|---|---|
| Size | 28.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4206e565a8d161c66152b7cbbaa1c84c8140b300359e8d75faec3fbd921ebd35
|
|
BLAKE2b-256 checksum How to use checksums |
1791fca038b5a2ad578d3f64ed232de13b01fc0eff11c55a6de79197c3764eb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|