mirror of
https://github.com/inventree/inventree-docs.git
synced 2025-06-13 18:55:26 +00:00
Initial commit
- Copied from inventree.github.io
This commit is contained in:
59
docs/report/labels.md
Normal file
59
docs/report/labels.md
Normal file
@ -0,0 +1,59 @@
|
||||
---
|
||||
title: Custom Labels
|
||||
layout: page
|
||||
---
|
||||
|
||||
## Custom Labels
|
||||
|
||||
InvenTree supports printing of custom template-based labels, using the [blabel](https://github.com/Edinburgh-Genome-Foundry/blabel) plugin for Python.
|
||||
|
||||
Custom labels can be generated using simple HTML templates, with support for QR-codes, and conditional formatting using the Jinja template engine.
|
||||
|
||||
!!! info "Documentation"
|
||||
Refer to the blabel documentation for further information
|
||||
|
||||
### Creating Labels
|
||||
|
||||
!!! missing "TODO"
|
||||
This section requires further work
|
||||
|
||||
### Stylesheet
|
||||
|
||||
!!! missing "TODO"
|
||||
This section requires further work
|
||||
|
||||
### Context Data
|
||||
|
||||
Each label template is supplied with *context data* (variables) which can be used to display information based on the context in which the label is printed.
|
||||
|
||||
!!! missing "TODO"
|
||||
This section requires further work
|
||||
|
||||
### QR Codes
|
||||
|
||||
!!! missing "TODO"
|
||||
This section requires further work
|
||||
|
||||
### Conditional Formatting
|
||||
|
||||
!!! missing "TODO"
|
||||
This section requires further work
|
||||
|
||||
## Stock Labels
|
||||
|
||||
!!! missing "TODO"
|
||||
This section requires further work
|
||||
|
||||
### Context Data
|
||||
|
||||
In addition to the global label context data, the following variables are made available to the StockItem label template:
|
||||
|
||||
* item - *The StockItem object itself*
|
||||
* part - *The Part object which is referenced by the StockItem object*
|
||||
* name - *The `name` field of the Part object*
|
||||
* ipn - *The `IPN` field of the Part object*
|
||||
* quantity - *The `quantity` field of the StockItem object*
|
||||
* serial - *The `serial` field of the StockItem object*
|
||||
* uid - *The `uid` field of the StockItem object*
|
||||
* qrcode - *JSON data representing the StockItem object, useful for rendering to a QR code*
|
||||
* tests - *Dict object of TestResult data associated with the StockItem*
|
9
docs/report/order.md
Normal file
9
docs/report/order.md
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
title: Order Report
|
||||
layout: page
|
||||
---
|
||||
|
||||
## Order Report
|
||||
|
||||
!!! missing "TODO"
|
||||
This section requires further work
|
9
docs/report/pack.md
Normal file
9
docs/report/pack.md
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
title: Packing List Report
|
||||
layout: page
|
||||
---
|
||||
|
||||
## Packing List
|
||||
|
||||
!!! missing "TODO"
|
||||
This section requires further work
|
68
docs/report/report.md
Normal file
68
docs/report/report.md
Normal file
@ -0,0 +1,68 @@
|
||||
---
|
||||
title: Report Generation
|
||||
layout: page
|
||||
---
|
||||
|
||||
## Custom Reporting
|
||||
|
||||
InvenTree supports a customizable reporting ecosystem, allowing the user to develop reporting templates that meet their particular needs.
|
||||
|
||||
PDF reports can be generated from either [HTML](https://github.com/fdemmer/django-weasyprint) or [LaTeX](https://github.com/weinbusch/django-tex) template files which are written by the user.
|
||||
|
||||
Reports are used in a variety of situations to format data in a friendly format for printing, distribution, conformance and testing.
|
||||
|
||||
In addition to providing the ability for end-users to provide their own reporting templates, some report types offer "built-in" report templates ready for use.
|
||||
|
||||
## Report Types
|
||||
|
||||
Following is a list of available report types
|
||||
|
||||
* [Test Report](/report/test): Format results of a test report against for a particular StockItem
|
||||
* [Packing List](/report/pack): Format a list of items for shipping or transfer
|
||||
* [Order List](/report/order): Order line items
|
||||
|
||||
## Template Formats
|
||||
|
||||
Report templates can be written in multiple formats as per the requirement of the user. Uploaded template files are passed through the django/jinja rendering framework, and as such accept the same variable template strings as any other django template file.
|
||||
|
||||
For example, rendering the name of a part (which is available in the particular template context as *part*) is as follows:
|
||||
|
||||
*The name of the part is **\{\{ part.name \}\}**.*
|
||||
|
||||
!!! info "Variables"
|
||||
Templates will have different variables available to them depending on the report type. Read the detail information on each report type for further information.
|
||||
|
||||
### HTML
|
||||
|
||||
HTML templating uses the [django-weasyprint](https://github.com/fdemmer/django-weasyprint) engine for rendering templated HTML files to PDF.
|
||||
|
||||
### LaTeX
|
||||
|
||||
LaTeX templating uses the [django-tex](https://github.com/weinbusch/django-tex) engine for rendering templated LaTeX files to PDF. Using LaTeX templates is much more complicated and requires advanced knowledge of configuring a LaTeX install. However it provides a much more powerful framework for generation of publication-quality documents.
|
||||
|
||||
!!! info "LaTeX Configuration"
|
||||
To use LaTeX templating, the system where InvenTree is installed must have a LaTeX toolchain accessible from the command line. Installation of such a toolchain is beyond the scope of this documenation.
|
||||
|
||||
!!! info "Special Characters"
|
||||
Special care must be taken to ensure that the LaTeX template file does not contain any LaTeX control characters that look like jinja template control codes!
|
||||
|
||||
#### Intepreter Selection
|
||||
|
||||
Out of the box, the LaTeX template rendering system is set to use *pdflatex* as the LaTeX interpreter. However this can easily be changed in the *config.yaml* configuration file:
|
||||
|
||||
``` yaml
|
||||
## LaTeX report rendering
|
||||
## InvenTree uses the django-tex plugin to enable LaTeX report rendering
|
||||
## Ref: https://pypi.org/project/django-tex/
|
||||
latex:
|
||||
## Select the LaTeX interpreter to use for PDF rendering
|
||||
## Note: The intepreter needs to be installed on the system!
|
||||
## e.g. to install pdflatex: apt-get texlive-latex-base
|
||||
interpreter: pdflatex
|
||||
## Extra options to pass through to the LaTeX interpreter
|
||||
options: ''
|
||||
```
|
||||
|
||||
## Uploading Templates
|
||||
|
||||
Custom report templates can be uploaded using the [Admin Interface](/admin/admin). Only users with admin access can upload and/or edit report template files.
|
54
docs/report/test.md
Normal file
54
docs/report/test.md
Normal file
@ -0,0 +1,54 @@
|
||||
---
|
||||
title: Test Report
|
||||
layout: page
|
||||
---
|
||||
|
||||
## Test Report
|
||||
|
||||
InvenTree provides [test result](/stock/test) tracking functionality which allows the users to keep track of any tests which have been performed on a given stock item.
|
||||
|
||||
Custom test reports may be generated against any given stock item. All testing data is made available to the template for custom rendering as required.
|
||||
|
||||
For example, an "Acceptance Test" report template may be customized to the particular device, with the results for certain tests rendering in a particular part of the page, with any tests which have not passed highlighted.
|
||||
|
||||
!!! missing "TODO"
|
||||
This section requires further work
|
||||
|
||||
### Part Filters
|
||||
|
||||
A TestReport template may define a set of filters against which parts are sorted. Any Part objects which match the provided filters can use the given TestReport.
|
||||
|
||||
This allows each TestReport to easily be assigned to a particular Part, or even multiple parts.
|
||||
|
||||
In the example below, a test report template is uploaded and assigned to the part with the name *"My Widget"*. Any combination of fields relevent to the Part model can be used here.
|
||||
|
||||
{% with id="test_report_add", url="admin/test_report_add.png", description="Upload test report template" %}
|
||||
{% include 'img.html' %}
|
||||
{% endwith %}
|
||||
|
||||
### Context Variables
|
||||
|
||||
The following context variables are made available to the TestReport template for rendering:
|
||||
|
||||
- **stock_item**: The individual stock item for which this test report is being generated
|
||||
- **part**: The Part of which the stock_item is an instance
|
||||
- **results**: A dict of test result objects, where the 'key' for each test result is a shortened version of the test name (see below)
|
||||
- **result_list**: A list of each test result object
|
||||
|
||||
#### Results
|
||||
|
||||
The *results* context variable provides a very convenient method of callout out a particular test result by name.
|
||||
|
||||
#### Example
|
||||
|
||||
Say for example that a Part "Electronic Widget" has a stock item with serial number #123, and has a test result uploaded called "Firmware Checksum". The templated file can reference this data as follows:
|
||||
|
||||
``` html
|
||||
<h3>Part: {% raw %}{{ part.name }}{% endraw %}</h3>
|
||||
<b>Serial Number: {% raw %}{{ stock_item.serial }}{% endraw %}</b>
|
||||
<hr>
|
||||
<p>
|
||||
Firmware Checksum: {% raw %}{{ results.firmwarechecksum.value }}.
|
||||
Uploaded by {{ results.firmwarechecksum.user }}{% endraw %}
|
||||
</p>
|
||||
```
|
Reference in New Issue
Block a user