1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

12255 inventory item device change (#12311)

* #12255 allow inventory items to change devices

* #12255 allow inventory item template to change devices

* #12255 fix init

* 12255 remove can_swtich from template model

* 12255 change to check module list
This commit is contained in:
Arthur Hanson
2023-04-21 09:36:11 -07:00
committed by GitHub
parent 12bb0ec1fe
commit 38a0ed5e24
2 changed files with 16 additions and 12 deletions

View File

@@ -97,7 +97,8 @@ class ComponentModel(NetBoxModel):
def clean(self):
super().clean()
if self.pk is not None and self._original_device != self.device_id:
# Check list of Modules that allow device field to be changed
if (type(self) not in [InventoryItem]) and (self.pk is not None) and (self._original_device != self.device_id):
raise ValidationError({
"device": "Components cannot be moved to a different device."
})