diff --git a/erpnext/selling/report/sales_analytics/sales_analytics.py b/erpnext/selling/report/sales_analytics/sales_analytics.py index f20f78d741dc30ebe2b33261e76ebee9e1bb1177..17c38bb525736ca3014665eaa6c8906f119e34b4 100644 --- a/erpnext/selling/report/sales_analytics/sales_analytics.py +++ b/erpnext/selling/report/sales_analytics/sales_analytics.py @@ -491,8 +491,8 @@ class Analytics: ) 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) @@ -508,8 +508,8 @@ class Analytics: ) 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)