Skip to content

Commit

Permalink
stock_location_zone: fix kind
Browse files Browse the repository at this point in the history
allow view locations in location structure
  • Loading branch information
jbaudoux committed Jun 16, 2024
1 parent c448eb0 commit a685595
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion stock_location_zone/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2017 Syvain Van Hoof (Okia sprl) <[email protected]>
# Copyright 2016-2019 Jacques-Etienne Baudoux (BCIM) <[email protected]>
# Copyright 2016 Jacques-Etienne Baudoux (BCIM) <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
Expand Down
14 changes: 9 additions & 5 deletions stock_location_zone/models/stock_location.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2017 Sylvain Van Hoof <[email protected]>
# Copyright 2018-2019 Jacques-Etienne Baudoux (BCIM sprl) <[email protected]>
# Copyright 2018 Jacques-Etienne Baudoux (BCIM) <[email protected]>
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

Expand Down Expand Up @@ -81,13 +81,17 @@ def _compute_zone_location_id(self):
)
def _compute_location_kind(self):
for location in self:
if location.zone_location_id and not location.area_location_id:
if location == location.zone_location_id:
location.location_kind = "zone"
continue

parent = location.location_id
if location.usage == "internal" and parent.usage == "view":
if (
# Internal locations whose parent is view are main stocks
location.usage in ("internal", "view")
and not location.zone_location_id
and parent.usage == "view"
):
location.location_kind = "stock"
elif (
# Internal locations having a zone and no children are bins
Expand All @@ -98,12 +102,12 @@ def _compute_location_kind(self):
):
location.location_kind = "bin"
elif (
location.usage == "internal"
# Internal locations having a zone and children are areas
location.usage in ("internal", "view")
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
Expand Down

0 comments on commit a685595

Please sign in to comment.