feat: tenant-aware netbox-inventory assets

Assets without a tenant take the tenant of the device, module, inventory item or
rack they are assigned to, both in clean() and before save. The plugin's assign,
reassign and "create hardware from asset" views save assets without a tenant
field and failed with mandatory tenancy before. Asset forms are also pre-filled
from an assigned module or inventory item. Existing tenants are never changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MrBlakeandClaude Opus 5.5 committed 2026-11-18 12:43:08 +01:00
1 parent 4dd01b82e3
commit cf1cafb632
5 files changed
+134 -1

No files matched your search

+9
View File
@@ -783,6 +783,15 @@ cable ends are evaluated; the tenant is only set if it is unambiguous. If an
automatically set tenant is saved unchanged, the browser asks for an explicit
confirmation.
Assets of the optional [netbox-inventory](https://github.com/ArnesSI/netbox-inventory)
plugin are tenant-aware as well: the asset forms are pre-filled like core
objects (also from an assigned module or inventory item), and an asset without
a tenant takes the tenant of the device, module, inventory item or rack it is
assigned to when it is saved. This keeps the plugin's *assign*, *reassign* and
*create hardware from asset* views working with mandatory tenancy, which save
the asset without a tenant field. An asset that is in stock and has no
assigned hardware still needs a tenant.
`tenant_required = False` disables the feature permanently and takes precedence
over the UI setting.