ArnesSI / netbox-inventory

Manage your hardware inventory in NetBox
MIT License
203 stars 19 forks source link

Sync device type changes #187

Open tpx-mk opened 1 month ago

tpx-mk commented 1 month ago

Similar to the sync of the Asset-Tag and Serial please add the possibility to sync the device type.

e.g. I'm creating devices via API call from another system, but as the other system doesn't know device types it creates a "dummy device" with the according asset. Afterwards I want to adjust the device type to the proper one but 1. it's not synced to the asset and 2. it's not even possible to change the asset at all (device types of assigned assets can't be changed).

tpx-mk commented 1 month ago

Just a little suggestion to at least allow editing the device type (or module type or inventoryitem type) within its own kind:

models.py:

[...]
        # if assigned to device/module/inventoryitem we can't change device_type/...
        if (
            self.instance.device or self.instance.module
            or self.instance.inventoryitem
        ):
#            self.fields['manufacturer'].disabled = True
#            for kind in HardwareKindChoices.values():
#                self.fields[f'{kind}_type'].disabled = True

            self.fields[f'device_type'].disabled = not self.instance.device
            self.fields[f'module_type'].disabled = not self.instance.module
            self.fields[f'inventoryitem_type'].disabled = not self.instance.inventoryitem
[...]
matejv commented 2 weeks ago

Yeah, this restriction turned out to be a pain in our operations as well. I'll consider allowing changing asset *_type within it's own kind and syncing the type of any related device or module.

Some forms might need additional filters to be easier to select the right asset on AssetDeviceRessign form for example.