|
|
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"
|
|