Internal Barcodes
Internal Barcodes¶
InvenTree defines an internal format for generating barcodes for various items. This format uses a simple JSON-style string to uniquely identify an item in the database.
Some simple examples of this format are shown below:
Model Type | Example Barcode |
---|---|
Part | {"part": 10} |
Stock Item | {"stockitem": 123} |
Supplier Part | {"supplierpart": 99} |
The numerical ID value used is the Primary Key (PK) of the particular object in the database.
Report Integration¶
This barcode format can be used to generate 1D or 2D barcodes (e.g. for labels and reports)
To access the raw barcode information string within a template, use the .barcode
attribute, and pass it into a barcode generation method.
Example: QR Code¶
For example, to render a QR-Code image for a part instance:
<img src='{% qrcode part.barcode %}'>
Barcode Formatting
Refer to the report documentation for further information on formatting barcode data