mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
* Allow re-assigning InventoryItem components * Refactor logic for finding initial component assignment on InventoryItems * PEP8 fix * Fix wrong HTML causing tab list to extend past the end of the parent row * Tweak form field labels Co-authored-by: jeremystretch <jstretch@ns1.com>
This commit is contained in:
@@ -1146,3 +1146,8 @@ class InventoryItem(MPTTModel, ComponentModel):
|
||||
# When moving an InventoryItem to another device, remove any associated component
|
||||
if self.component and self.component.device != self.device:
|
||||
self.component = None
|
||||
else:
|
||||
if self.component and self.component.device != self.device:
|
||||
raise ValidationError({
|
||||
"device": "Cannot assign inventory item to component on another device"
|
||||
})
|
||||
|
Reference in New Issue
Block a user