diff --git a/erpnext/selling/report/sales_analytics/sales_analytics.py b/erpnext/selling/report/sales_analytics/sales_analytics.py index 605d2fac44f0db696f0b4f460e8ed09d9f178635..a71b4c5627d177db2c51e630378c39d4a2d7991f 100644 --- a/erpnext/selling/report/sales_analytics/sales_analytics.py +++ b/erpnext/selling/report/sales_analytics/sales_analytics.py @@ -378,8 +378,8 @@ class Analytics(object): ) for d in self.group_entries: - if d.parent: - self.depth_map.setdefault(d.name, self.depth_map.get(d.parent) + 1) + if d.parent and (depth_map := self.depth_map.get(d.parent)): # @dokos + self.depth_map.setdefault(d.name, depth_map + 1) # @dokos else: self.depth_map.setdefault(d.name, 0) @@ -397,8 +397,8 @@ class Analytics(object): ) for d in self.group_entries: - if d.parent: - self.depth_map.setdefault(d.name, self.depth_map.get(d.parent) + 1) + if d.parent and (depth_map := self.depth_map.get(d.parent)): # @dokos + self.depth_map.setdefault(d.name, depth_map + 1) # @dokos else: self.depth_map.setdefault(d.name, 0)