-
-
Notifications
You must be signed in to change notification settings - Fork 738
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow view locations in location structure
- Loading branch information
Showing
2 changed files
with
10 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). | ||
|
||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). | ||
|
||
|
@@ -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 | ||
|
@@ -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 | ||
|