[FR] Generic custom fields

This issue has been tracked since 2023-01-17.

Please verify that this feature request has NOT been suggested before.

  • I checked and didn't find similar feature request

Problem statement

When we receive certain stock items, we need to apply an internal barcode to them. This barcode is part of a much larger system that we cannot alter/influence. These barcodes are printed/created by the property team; we get a roll of them, apply them to devices, and then notify the property team what barcodes were applied to which devices. We'd like to track that internal barcode in addition to the stock item serial number. Additionally, it needs to be searchable.

Suggested solution

As a possible solution, there could just be an additional field added to the stock object called 'asset tag' lower level of effort required, but less flexibility.

Another possible solution would be allow users to define custom fields in each part (or in the admin panel, for the stock model in general), but that were unique to each instance of the stock. Then we could not only define 'asset tags' but then also things like 'this device was purchased for (re: with the money from) blue customer, or our red customer` (something else we need to do for compliance reasons).

Describe alternatives you've considered

We've looked at using the Stock Item Notes, but this field is not indexed by search (understandably so), meaning that its difficult to reference stock items by the contents of that field.

Examples of other systems

We also use Netbox, and it handles this in a relatively elegant way; custom fields for each model (it's also Django based).

Do you want to develop this?

  • I want to develop this.
mddeff wrote this answer on 2023-01-23

Also, if I totally missed where this is implemented, please let me know; happy to accept its a PEBKAC issue.

matmair wrote this answer on 2023-01-23

@mddeff why don't you associate the internal barcode with the stock item as a barcode? Maybe I am misunderstanding your request but it seems the function is already there.

mddeff wrote this answer on 2023-01-23

So, unfortunately in our environment (datacenter with high compliance restrictions) we cant utilize the mobile app or barcode scanners hooked up to computers unless they've been specifically approved. And getting them approved is a sisyphean task. (not something I expected one to divine from my initial FR)

That being said, the example I provided in the initial suggestion was just one use case. We have other use cases where we need to associate arbitrary data to ever stock or part in inventree:

  • what contract was this purchased on (pre-determined list of choices)
  • has the device been sanitized, etc. (boolean)
  • aforementioned asset tag (freeform text field)

I could have worded the original request better to better describe the other use cases; I'm happy to edit if preferred.

matmair wrote this answer on 2023-01-23

You could also add the values hand into the text field.

We provide additional meta fields to plugins / via the API - not sure if we should add more options @SchrodingersGat

miggland wrote this answer on 2023-01-23

This sounds like it is along the lines of my reasoning why all models should have metadata attached - these are a basis for adding custom fields: #4202

Making them available and editable in the GUI is another issue, of course..

SchrodingersGat wrote this answer on 2023-01-30

When we receive certain stock items, we need to apply an internal barcode to them.

Maybe I'm missing something from the discussion here, but InvenTree already supports custom barcodes for stock items?

mddeff wrote this answer on 2023-01-30

You could also add the values hand into the text field.

We looked at that, but unfortunately the text field is not indexed (not saying it should be); this means that we cant search inventree by contents of that field.

Maybe I'm missing something from the discussion here, but InvenTree already supports custom barcodes for stock items?

The issue we have with barcodes is that we dont have any way (at least, today) to connect a barcode scanner (or camera, or mobile device) to the same network that has our instance of inventree running on it. When I try to type in the barcode manually (it's only 5-7 characters long), it assigns a long ID in the barcode field and I cant search by the text I had entered. I understand this is a unique aspect of our deployment that I dont expect inventree to handle (very much a corner case).

But barcode was only one example, the larger issue is that we're running into several fields that are specific to our environment that we need to track per stock item that we just dont have a way to do today. This could be everything from:

  • internal team a stock item is associated with
  • who is registered on our internal property books as being the "responsible person"
  • additional serial number like unique identifiers that are not the serial number (express service code, first Ethernet MAC address, etc.)
  • Tracking number on the internal document we use to track stock movement

The example I referenced was Netbox, where they have per-model custom fields that can be defined in the admin page, and then utilized in the app. Does that clarify the use case at all? (genuinely asking)

SchrodingersGat wrote this answer on 2023-01-30

@mddeff the closest thing we currently offer "out of the box" is that the StockItem model has a "metadata" parameter which is a JSON object field which can contain any custom user data of arbitrary complexity. This can be accessed / edited via the API or the admin interface (currently not exposed via the web interface).

Does this perhaps go some way towards what you are looking for?

mddeff wrote this answer on 2023-01-30

@SchrodingersGat , It does sound like its in the right direction; does any of that get parsed/indexed by the main site search? I'm assuming to integrate it into the UI, somebody would have to write a plugin? The target audience who would need to interface this isnt likely to have access to (or want to use) the admin interface.

SchrodingersGat wrote this answer on 2023-01-30

@mddeff sounds like a plugin would be suitable here. The admin interface is certainly clunky and not designed for everyday use

Does any of that get parsed/indexed by the main site search?

Nope, metadata is not parsed by the search engine

DaveDavenport wrote this answer on 2023-02-09

I think a generic way to add (searchable) custom fields that can be set on a stock item would be beneficial.

In my usecase I have docks/pcs/etc, those have a trackable serial number, a service tag and more. This works well as I set the part as 'trackable' and enter the serial for each stock item. However I would also like to store the service tag and MAC address for each stock item (in a searchable manner). Currently I have not found a way to do this.

matmair wrote this answer on 2023-02-09

Search engine is a bit misleading. Our search is a bunch of API calls strung together. Adding anything there is not an easy feat without slowing the userinterface down.

If you only need asset managment I would suggest looking into netbox / snipe-it as this FR will take a while to develop and no dev has signed up to do it in the last 3 weeks. I use snipe-it for (IT) asset management at work and netbox for network infrastructure.

DaveDavenport wrote this answer on 2023-02-09

Yeah, I should not have used dock/pc as use-case, I thought it was a clear understandable example I just happened to run into today. It is not our main use.
We tried snipe-it before, but it did not work out for our use. Inventree fits it much better (even with this limitation we don't want to go back).

More Details About Repo
Owner Name inventree
Repo Name InvenTree
Full Name inventree/InvenTree
Language Python
Created Date 2017-03-23
Updated Date 2023-03-31
Star Count 2586
Watcher Count 61
Fork Count 411
Issue Count 141

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date