diff --git a/netbox/dcim/models/device_components.py b/netbox/dcim/models/device_components.py index 4a93e4a80..639f8aadb 100644 --- a/netbox/dcim/models/device_components.py +++ b/netbox/dcim/models/device_components.py @@ -1283,10 +1283,3 @@ class InventoryItem(MPTTModel, ComponentModel, TrackingModelMixin): raise ValidationError({ "device": _("Cannot assign inventory item to component on another device") }) - - @property - def children(self): - return InventoryItem.objects.filter( - device=self.device, - parent=self - ) diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 6bd664104..c67dfaade 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -3002,14 +3002,14 @@ class InventoryItemChildrenView(generic.ObjectChildrenView): template_name = 'generic/object_children.html' tab = ViewTab( label=_('Children'), - badge=lambda obj: obj.children.count(), + badge=lambda obj: obj.child_items.count(), permission='dcim.view_inventoryitem', hide_if_empty=True, weight=5000 ) def get_children(self, request, parent): - return parent.children.restrict(request.user, 'view') + return parent.child_items.restrict(request.user, 'view') #