Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Stock Location Zone

Entity: stock.location

Compute Method: _compute_location_kind

Inputs Method Outputs
for location in self:
            if location.zone_location_id and not location.area_location_id:
                location.location_kind = "zone"
                continue

            parent = location.location_id
            if location.usage == "internal" and parent.usage == "view":
                # Internal locations whose parent is view are main stocks
                location.location_kind = "stock"
            elif (
                # Internal locations having a zone and no children are bins
                location.usage == "internal"
                and location.zone_location_id
                and location.area_location_id
                and not location.child_ids
            ):
                location.location_kind = "bin"
            elif (
                location.usage == "internal"
                and location.zone_location_id
                and location.area_location_id
                and location.child_ids
            ):
                # Internal locations having a zone and children are areas
                location.location_kind = "area"
            else:
                # All the rest are other locations
                location.location_kind = "other"

Back to entity