Repository
OCA/stock-logistics-warehouse · module folder · Try on Runboat
Module version
1.0.1
Category
Hidden
Folder size
0.03 MB
License
LGPL-3
Application
No
Auto-installable
No
Website
https://github.com/OCA/stock-logistics-warehouse
Last tracking update
2026-08-07 08:42:50
Authors
Odoo Community Association (OCA), MT Software
Maintainers
Odoo Community Association (OCA), MT Software
Committers
Michael Tietz, Weblate, OCA-git-bot, oca-ci, Azar Nazari
Odoo dependencies
Python dependencies
None
System dependencies
None
Required by
stock_location_orderpoint, stock_reserve_rule
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:**

```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)

Code Analysis

Views touched (0)

No views found for this module.

HTTP endpoints (0)

No HTTP endpoints found for this module.

Models touched (1)

New fields (0)

No new fields.

Public methods (0)

No public methods.