Browse Source

Fixes #9007: Fix FieldError exception when instantiating a device type with nested inventory items

jeremystretch 3 years ago
parent
commit
4fae42de51

+ 1 - 0
docs/release-notes/version-3.2.md

@@ -157,6 +157,7 @@ Where it is desired to limit the range of available VLANs within a group, users
 * [#8970](https://github.com/netbox-community/netbox/issues/8970) - Permit nested inventory item templates on device types
 * [#8976](https://github.com/netbox-community/netbox/issues/8976) - Add missing `object_type` field on CustomField REST API serializer
 * [#8978](https://github.com/netbox-community/netbox/issues/8978) - Fix instantiation of front ports when provisioning a module
+* [#9007](https://github.com/netbox-community/netbox/issues/9007) - Fix FieldError exception when instantiating a device type with nested inventory items
 
 ### Other Changes
 

+ 1 - 1
netbox/dcim/models/device_component_templates.py

@@ -551,7 +551,7 @@ class InventoryItemTemplate(MPTTModel, ComponentTemplateModel):
         unique_together = ('device_type', 'parent', 'name')
 
     def instantiate(self, **kwargs):
-        parent = InventoryItemTemplate.objects.get(name=self.parent.name, **kwargs) if self.parent else None
+        parent = InventoryItem.objects.get(name=self.parent.name, **kwargs) if self.parent else None
         if self.component:
             model = self.component.component_model
             component = model.objects.get(name=self.component.name, **kwargs)