From 65d22502d5ae74ba970e64959e2c6df6f61d5ca6 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 21 Jul 2021 22:15:46 +1000 Subject: [PATCH] Add documentation for part labels --- docs/report/labels.md | 46 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/docs/report/labels.md b/docs/report/labels.md index 182088f..4da1385 100644 --- a/docs/report/labels.md +++ b/docs/report/labels.md @@ -184,7 +184,6 @@ To extend this template in a custom uploaded label, simply extend as follows: {% endraw %} ``` - ## Stock Item Labels 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 | | uid | The `uid` field of the StockItem object | | 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 @@ -260,3 +260,47 @@ The following variables are made available to the StockLocation label template: | Variable | Description | | -------- | ----------- | | 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 %} +``` \ No newline at end of file