Stock Route Location Source
stock_route_location_source · OCA/stock-logistics-warehouse
-
Security25/25No findings
-
Activity12/25Last human commit 17 months ago
-
Required by20/253 modules depend on it
-
Maturity5/25In 1 Odoo series since 18.0
Heuristic over the facts below, not an audit · How it's computed
Description
Add method to get source location of Inventory Routes
This technical module extends the stock.route model to add the method
_get_source_location(dest_location). It recursively traces upstream
rules (pull or pull_push) from a destination location, and returns
the ultimate source location — stopping at a rule with procure_method='make_to_stock'
or when no applicable pull rules remain.
Useful for multi-hop route setups (e.g., warehouse → packing → output), to programmatically determine the actual stock source. No UI changes are made — it's purely for custom logic or other technical modules.
Example usage:
route = env.ref("stock.route_warehouse0_mto")
dest = env.ref("stock.stock_location_customers")
src = route._get_source_location(dest)
print(src.display_name)
Dependencies
- Odoo dependencies
- Python dependencies
- None
- System dependencies
- None
- Required by
- stock_location_orderpoint, stock_move_source_relocate, stock_reserve_rule
Code analysis
Extracted from the source by best-effort static analysis (no code is executed); details may be incomplete.
Views touched 0
No views found for this module.
HTTP endpoints 0
No HTTP endpoints found for this module.
Models touched 1
No new fields.
Public methods (0)No public methods.