mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #9055: Restore ability to move inventory item to other device
This commit is contained in:
@ -9,6 +9,7 @@
|
|||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
* [#8931](https://github.com/netbox-community/netbox/issues/8931) - Copy assigned tenant when cloning a location
|
* [#8931](https://github.com/netbox-community/netbox/issues/8931) - Copy assigned tenant when cloning a location
|
||||||
|
* [#9055](https://github.com/netbox-community/netbox/issues/9055) - Restore ability to move inventory item to other device
|
||||||
* [#9057](https://github.com/netbox-community/netbox/issues/9057) - Fix missing instance counts for module types
|
* [#9057](https://github.com/netbox-community/netbox/issues/9057) - Fix missing instance counts for module types
|
||||||
* [#9061](https://github.com/netbox-community/netbox/issues/9061) - Change inheritance order for DeviceComponentFilterSets
|
* [#9061](https://github.com/netbox-community/netbox/issues/9061) - Change inheritance order for DeviceComponentFilterSets
|
||||||
* [#9065](https://github.com/netbox-community/netbox/issues/9065) - Min/max VID should not be required when filtering VLAN groups
|
* [#9065](https://github.com/netbox-community/netbox/issues/9065) - Min/max VID should not be required when filtering VLAN groups
|
||||||
|
@ -1204,6 +1204,10 @@ class InventoryItemBulkEditForm(
|
|||||||
form_from_model(InventoryItem, ['label', 'role', 'manufacturer', 'part_id', 'description']),
|
form_from_model(InventoryItem, ['label', 'role', 'manufacturer', 'part_id', 'description']),
|
||||||
NetBoxModelBulkEditForm
|
NetBoxModelBulkEditForm
|
||||||
):
|
):
|
||||||
|
device = DynamicModelChoiceField(
|
||||||
|
queryset=Device.objects.all(),
|
||||||
|
required=False
|
||||||
|
)
|
||||||
role = DynamicModelChoiceField(
|
role = DynamicModelChoiceField(
|
||||||
queryset=InventoryItemRole.objects.all(),
|
queryset=InventoryItemRole.objects.all(),
|
||||||
required=False
|
required=False
|
||||||
@ -1215,7 +1219,7 @@ class InventoryItemBulkEditForm(
|
|||||||
|
|
||||||
model = InventoryItem
|
model = InventoryItem
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(None, ('label', 'role', 'manufacturer', 'part_id', 'description')),
|
(None, ('device', 'label', 'role', 'manufacturer', 'part_id', 'description')),
|
||||||
)
|
)
|
||||||
nullable_fields = ('label', 'role', 'manufacturer', 'part_id', 'description')
|
nullable_fields = ('label', 'role', 'manufacturer', 'part_id', 'description')
|
||||||
|
|
||||||
|
@ -1362,6 +1362,9 @@ class PopulateDeviceBayForm(BootstrapMixin, forms.Form):
|
|||||||
|
|
||||||
|
|
||||||
class InventoryItemForm(NetBoxModelForm):
|
class InventoryItemForm(NetBoxModelForm):
|
||||||
|
device = DynamicModelChoiceField(
|
||||||
|
queryset=Device.objects.all()
|
||||||
|
)
|
||||||
parent = DynamicModelChoiceField(
|
parent = DynamicModelChoiceField(
|
||||||
queryset=InventoryItem.objects.all(),
|
queryset=InventoryItem.objects.all(),
|
||||||
required=False,
|
required=False,
|
||||||
@ -1399,9 +1402,6 @@ class InventoryItemForm(NetBoxModelForm):
|
|||||||
'device', 'parent', 'name', 'label', 'role', 'manufacturer', 'part_id', 'serial', 'asset_tag',
|
'device', 'parent', 'name', 'label', 'role', 'manufacturer', 'part_id', 'serial', 'asset_tag',
|
||||||
'description', 'component_type', 'component_id', 'tags',
|
'description', 'component_type', 'component_id', 'tags',
|
||||||
]
|
]
|
||||||
widgets = {
|
|
||||||
'device': forms.HiddenInput(),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
from dcim.models import *
|
from dcim.models import *
|
||||||
from extras.models import Tag
|
|
||||||
from netbox.forms import NetBoxModelForm
|
from netbox.forms import NetBoxModelForm
|
||||||
from utilities.forms import (
|
from utilities.forms import (
|
||||||
BootstrapMixin, DynamicModelChoiceField, DynamicModelMultipleChoiceField, ExpandableNameField,
|
BootstrapMixin, DynamicModelChoiceField, DynamicModelMultipleChoiceField, ExpandableNameField,
|
||||||
@ -12,6 +11,7 @@ __all__ = (
|
|||||||
'DeviceComponentCreateForm',
|
'DeviceComponentCreateForm',
|
||||||
'FrontPortCreateForm',
|
'FrontPortCreateForm',
|
||||||
'FrontPortTemplateCreateForm',
|
'FrontPortTemplateCreateForm',
|
||||||
|
'InventoryItemCreateForm',
|
||||||
'ModularComponentTemplateCreateForm',
|
'ModularComponentTemplateCreateForm',
|
||||||
'ModuleBayCreateForm',
|
'ModuleBayCreateForm',
|
||||||
'ModuleBayTemplateCreateForm',
|
'ModuleBayTemplateCreateForm',
|
||||||
@ -199,6 +199,11 @@ class ModuleBayCreateForm(DeviceComponentCreateForm):
|
|||||||
field_order = ('device', 'name_pattern', 'label_pattern', 'position_pattern')
|
field_order = ('device', 'name_pattern', 'label_pattern', 'position_pattern')
|
||||||
|
|
||||||
|
|
||||||
|
class InventoryItemCreateForm(ComponentCreateForm):
|
||||||
|
# Device is assigned by the model form
|
||||||
|
field_order = ('name_pattern', 'label_pattern')
|
||||||
|
|
||||||
|
|
||||||
class VirtualChassisCreateForm(NetBoxModelForm):
|
class VirtualChassisCreateForm(NetBoxModelForm):
|
||||||
region = DynamicModelChoiceField(
|
region = DynamicModelChoiceField(
|
||||||
queryset=Region.objects.all(),
|
queryset=Region.objects.all(),
|
||||||
|
@ -2517,7 +2517,7 @@ class InventoryItemEditView(generic.ObjectEditView):
|
|||||||
|
|
||||||
class InventoryItemCreateView(generic.ComponentCreateView):
|
class InventoryItemCreateView(generic.ComponentCreateView):
|
||||||
queryset = InventoryItem.objects.all()
|
queryset = InventoryItem.objects.all()
|
||||||
form = forms.DeviceComponentCreateForm
|
form = forms.InventoryItemCreateForm
|
||||||
model_form = forms.InventoryItemForm
|
model_form = forms.InventoryItemForm
|
||||||
template_name = 'dcim/inventoryitem_create.html'
|
template_name = 'dcim/inventoryitem_create.html'
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user