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_zone_location_id

Inputs Method Outputs
self_browse = self.browse()
self.update({"zone_location_id": self_browse, "area_location_id": self_browse})
for location in self:
            if location.is_zone:
                location.zone_location_id = location
                continue
            parent = location.location_id
            if parent.zone_location_id:
                # If we have more than one level of area in a zone,
                # the grouping is done by the first level
                if parent.area_location_id:
                    area_location_id = parent.area_location_id
                else:
                    area_location_id = location
                location.update(
                    {
                        "zone_location_id": parent.zone_location_id,
                        "area_location_id": area_location_id,
                    }
                )

Back to entity