2
0
mirror of https://github.com/inventree/inventree-docs.git synced 2025-04-28 21:56:49 +00:00

Merge pull request #137 from inventree/params-context

Add documentation for part labels
This commit is contained in:
Oliver 2021-07-21 22:17:44 +10:00 committed by GitHub
commit 6c4d9f9144
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -184,7 +184,6 @@ To extend this template in a custom uploaded label, simply extend as follows:
{% endraw %} {% endraw %}
``` ```
## Stock Item Labels ## Stock Item Labels
Stock Item label templates are used to generate labels for individual Stock Items. Stock Item label templates are used to generate labels for individual Stock Items.
@ -224,6 +223,7 @@ The following variables are made available to the StockItem label template:
| serial | The `serial` field of the StockItem object | | serial | The `serial` field of the StockItem object |
| uid | The `uid` field of the StockItem object | | uid | The `uid` field of the StockItem object |
| tests | Dict object of TestResult data associated with the StockItem | | tests | Dict object of TestResult data associated with the StockItem |
| parameters | Dict object containing the parameters associated with the base Part |
### URL-style QR code ### URL-style QR code
@ -260,3 +260,47 @@ The following variables are made available to the StockLocation label template:
| Variable | Description | | Variable | Description |
| -------- | ----------- | | -------- | ----------- |
| location | The StockLocation object itself | | location | The StockLocation object itself |
## Part Labels
Part label templates are used to generate labels for individual Part instances.
### Creating Part Label Templates
Part label templates are added (and edited) via the admin interface.
### Printing Part Labels
Part label can be printed using the following approaches:
To print a single part label from the Part detail view, select the *Print Label* option.
To print multiple part labels, select multiple parts in the part table and select the *Print Labels* option.
### Context Data
The following context variables are made available to the Part label template:
| Variable | Description |
| -------- | ----------- |
| part | The part object |
| category | The PartCategory which contains the Part |
| name | The name of the part |
| description | The description text for the part |
| IPN | Internal part number (IPN) for the part |
| revision | Part revision code |
| qr_data | String data which can be rendered to a QR code |
| parameters | Map (Python dictionary) object containing the parameters associated with the part instance |
#### Parameters
The part parameters can be accessed by parameter name lookup in the template, as follows:
```html
{% raw %}
Part: {{ part.name }}
Length: {{ parameters.length }}
{% endraw %}
```