diff --git a/docs/release-notes/version-3.2.md b/docs/release-notes/version-3.2.md index c45436d07..e3332d706 100644 --- a/docs/release-notes/version-3.2.md +++ b/docs/release-notes/version-3.2.md @@ -151,6 +151,7 @@ Where it is desired to limit the range of available VLANs within a group, users * [#8845](https://github.com/netbox-community/netbox/issues/8845) - Correct default ASN formatting in table * [#8869](https://github.com/netbox-community/netbox/issues/8869) - Fix NoReverseMatch exception when displaying tag w/assignments * [#8872](https://github.com/netbox-community/netbox/issues/8872) - Enable filtering by custom object fields +* [#8970](https://github.com/netbox-community/netbox/issues/8970) - Permit nested inventory item templates on device types ### Other Changes diff --git a/netbox/dcim/forms/models.py b/netbox/dcim/forms/models.py index 6cdcb372c..6054ee7bf 100644 --- a/netbox/dcim/forms/models.py +++ b/netbox/dcim/forms/models.py @@ -1025,10 +1025,10 @@ class DeviceBayTemplateForm(BootstrapMixin, forms.ModelForm): class InventoryItemTemplateForm(BootstrapMixin, forms.ModelForm): parent = DynamicModelChoiceField( - queryset=InventoryItem.objects.all(), + queryset=InventoryItemTemplate.objects.all(), required=False, query_params={ - 'device_id': '$device' + 'devicetype_id': '$device_type' } ) role = DynamicModelChoiceField( @@ -1050,11 +1050,6 @@ class InventoryItemTemplateForm(BootstrapMixin, forms.ModelForm): widget=forms.HiddenInput ) - fieldsets = ( - ('Inventory Item', ('device_type', 'parent', 'name', 'label', 'role', 'description')), - ('Hardware', ('manufacturer', 'part_id')), - ) - class Meta: model = InventoryItemTemplate fields = [ diff --git a/netbox/dcim/tables/devicetypes.py b/netbox/dcim/tables/devicetypes.py index e5e703ee0..f5f5ed7bf 100644 --- a/netbox/dcim/tables/devicetypes.py +++ b/netbox/dcim/tables/devicetypes.py @@ -241,5 +241,7 @@ class InventoryItemTemplateTable(ComponentTemplateTable): class Meta(ComponentTemplateTable.Meta): model = InventoryItemTemplate - fields = ('pk', 'name', 'label', 'role', 'manufacturer', 'part_id', 'component', 'description', 'actions') + fields = ( + 'pk', 'name', 'label', 'parent', 'role', 'manufacturer', 'part_id', 'component', 'description', 'actions', + ) empty_text = "None" diff --git a/netbox/templates/dcim/component_template_create.html b/netbox/templates/dcim/component_template_create.html index b3c5332b9..d164db872 100644 --- a/netbox/templates/dcim/component_template_create.html +++ b/netbox/templates/dcim/component_template_create.html @@ -2,33 +2,37 @@ {% load form_helpers %} {% block form %} -