Quellcode durchsuchen

Fixes #9491: Remove button for adding inventory item templates to module type components

jeremystretch vor 3 Jahren
Ursprung
Commit
8c220cc04f
2 geänderte Dateien mit 2 neuen und 1 gelöschten Zeilen
  1. 1 0
      docs/release-notes/version-3.2.md
  2. 1 1
      netbox/dcim/tables/template_code.py

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

@@ -14,6 +14,7 @@
 
 ### Bug Fixes
 
+* [#9491](https://github.com/netbox-community/netbox/issues/9491) - Remove button for adding inventory item templates to module type components
 * [#9979](https://github.com/netbox-community/netbox/issues/9979) - Fix Markdown rendering for custom fields in table columns
 * [#9986](https://github.com/netbox-community/netbox/issues/9986) - Workaround for upstream timezone data bug
 

+ 1 - 1
netbox/dcim/tables/template_code.py

@@ -100,7 +100,7 @@ LOCATION_BUTTONS = """
 
 MODULAR_COMPONENT_TEMPLATE_BUTTONS = """
 {% load helpers %}
-{% if perms.dcim.add_inventoryitemtemplate %}
+{% if perms.dcim.add_inventoryitemtemplate and record.device_type_id %}
 <a href="{% url 'dcim:inventoryitemtemplate_add' %}?device_type={{ record.device_type_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={{ request.path }}" title="Add inventory item" class="btn btn-primary btn-sm">
   <i class="mdi mdi-plus-thick" aria-hidden="true"></i>
 </a>