Stock Route Location Source

stock_route_location_source
REPOSITORY
REPOSITORYOCA/stock-logistics-warehouse
GIT
GIThttps://github.com/OCA/stock-logistics-warehouse.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/stock-logistics-warehouse/tree/18.0/stock_route_location_source
VERSION
VERSION 1.0.1
CATEGORY
CATEGORYHidden
LICENSE
LICENSELGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), MT Software
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), MT Software
COMMITTERS
COMMITTERSWeblate, OCA-git-bot, Michael Tietz, oca-ci, Azar Nazari
WEBSITE
WEBSITEhttps://github.com/OCA/stock-logistics-warehouse
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 19:30:06
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - stock
    - product
    - base
    - mail
    - base_setup
    - web
    - bus
    - web_tour
    - html_editor
    - uom
    - barcodes_gs1_nomenclature
    - barcodes
    - digest
    - portal
    - web_editor
    - http_routing
    - auth_signup
    - resource
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
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.

Models touched (1)

New fields (0)

No new fields.

Public methods (0)

No public methods.