2 inventory items with same names in one parent #7542

Closed
opened 2025-12-29 20:24:55 +01:00 by adam · 1 comment
Owner

Originally created by @g0ha1 on GitHub (Jan 20, 2023).

NetBox version

v3.4.2

Python version

3.8

Steps to Reproduce

  1. create A inventory item with name "item1" in some device (for example with id 32):
    a_item = nb.dcim.inventory_items.create(device = 32, name = 'item1')

  2. create B inventory item with name "item1" in same device (with id 32):
    b_item = nb.dcim.inventory_items.create(device = 32, name = 'item1')

  3. create C inventory item with name "parent" in same device (with id 32):
    c_item = nb.dcim.inventory_items.create(device = 32, name = 'parent')

  4. add C item as parent to A item and save
    a_item.parent = c_item['id']
    a_item.save()
    True

  5. add C item as parent to B item and save

Expected Behavior

Expectred the same behavior as in step 4:
b_item.parent = c_item['id']
b_item.save()
True

Observed Behavior

Got error "Inventory item with this Device, Parent and Name already exists."

Originally created by @g0ha1 on GitHub (Jan 20, 2023). ### NetBox version v3.4.2 ### Python version 3.8 ### Steps to Reproduce 1. create A inventory item with name "item1" in some device (for example with id 32): a_item = nb.dcim.inventory_items.create(device = 32, name = 'item1') 2. create B inventory item with name "item1" in same device (with id 32): b_item = nb.dcim.inventory_items.create(device = 32, name = 'item1') 3. create C inventory item with name "parent" in same device (with id 32): c_item = nb.dcim.inventory_items.create(device = 32, name = 'parent') 4. add C item as parent to A item and save a_item.parent = c_item['id'] a_item.save() True 5. add C item as parent to B item and save ### Expected Behavior Expectred the same behavior as in step 4: b_item.parent = c_item['id'] b_item.save() True ### Observed Behavior Got error "Inventory item with this Device, Parent and Name already exists."
adam closed this issue 2025-12-29 20:24:55 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jan 20, 2023):

This is intended behavior: Each child item must have a unique name. Otherwise, it may be impossible to distinguish between them.

@jeremystretch commented on GitHub (Jan 20, 2023): This is intended behavior: Each child item must have a unique name. Otherwise, it may be impossible to distinguish between them.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7542