Stock Route Location Source
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:
`python route = env.ref("stock.route_warehouse0_mto") dest = env.ref("stock.stock_location_customers") src = route._get_source_location(dest) print(src.display_name)
auto_awesome What this module does
AI-generated from the code · Odoo 18.0This hidden technical module adds a helper method to Inventory Routes so other customizations can find the real source location of stock for a given destination.
This module does not add any screen, menu, button or report. It only extends the existing Inventory Route model (stock.route) with one extra method called _get_source_location.
What it does: given a destination location, the method follows the route's rules backwards, step by step, to find where the stock actually comes from. It keeps moving upstream through pull or pull-push rules until it reaches a rule that takes stock from existing inventory (make to stock) or until there are no more applicable pull rules. The result is the ultimate source location.
- It works on a single route and a single destination location at a time.
- It only follows rules whose action is pull or pull_push.
- It stops when a rule is set to make to stock.
- It returns an empty location if no suitable rule is found.
This is useful in multi-step setups such as warehouse to packing to output, where you need to know programmatically which location really supplies the goods. Because the module is in the Hidden category and has no user interface, business users will not see any change in Odoo; it is meant for developers or other technical modules that need this calculation.
Depends on
Required by other modules
Models and fields (1)
- stock.route · extends an existing model
Text generated by AI (DeepSeek) from reading the Odoo 18.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub
Availability by version
Reviewed: 2026-11-03Confirmation status: 1 confirmed, 8 with no information of 9 versions.
Sources · Odoo 18.0
Confirmed on 2026-11-03 in branch 18.0 of OCA/stock-logistics-warehouse.
terminal Installation and usage
No verified informationInstallation instructions, the distribution package, dependencies and configuration steps are not shown because they have not yet been verified in the module documentation for any version.
Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.