Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asset tag is not unique #149

Closed
alehaa opened this issue Feb 23, 2024 · 1 comment · Fixed by #183
Closed

Asset tag is not unique #149

alehaa opened this issue Feb 23, 2024 · 1 comment · Fixed by #183
Assignees

Comments

@alehaa
Copy link
Contributor

alehaa commented Feb 23, 2024

When you add a bunch of items using Create & Add Another, the value of the Asset Tag is copied to the next form. However, this is confusing because an asset tag should be unique somehow to uniquely identify an asset.

After looking at the NetBox code, I see that the dcim.Device model uses a unique constraint for field asset_tag, so I'd suggest doing the same for this plugin to have consistent behavior.

@matejv
Copy link
Member

matejv commented Apr 18, 2024

netbox_inventory enforces that the combination of asset.owner and asset.asset_tag is unique.

I intentionally keep the old asset tag value when using "Create & add another" since my thinking is: if you're adding multiple of similar asset in a row, and you keep track of asset tags, it's likely that your asset tags will be sequential. Sou you can just increment the last number of old asset tag instead of having to type the whole value in again (increasing the chance of a type in the process).

What I did miss is that if the asset owner is not set, the asset tag value uniqueness is then not enforced. I'll take a look how this can be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants