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

This commit is contained in:
jeremystretch 2022-03-31 12:07:02 -04:00
parent 1d55c04c21
commit 4fae42de51
2 changed files with 2 additions and 1 deletions

View File

@ -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

View File

@ -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)