diff --git a/_includes/config.yaml b/_includes/config.yaml index c655ffd..18e3197 100644 --- a/_includes/config.yaml +++ b/_includes/config.yaml @@ -107,19 +107,6 @@ static_root: '../inventree_static' # If unspecified, the local user's temp directory will be used #backup_dir: '/home/inventree/backup/' -# LaTeX report rendering -# InvenTree uses the django-tex plugin to enable LaTeX report rendering -# Ref: https://pypi.org/project/django-tex/ -# Note: Ensure that a working LaTeX toolchain is installed and working *before* starting the server -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 - enabled: False - interpreter: pdflatex - # Extra options to pass through to the LaTeX interpreter - options: '' - # Permit custom authentication backends #authentication_backends: # - 'django.contrib.auth.backends.ModelBackend' diff --git a/docs/extend/plugins.md b/docs/extend/plugins.md index 30fab08..9a230c7 100644 --- a/docs/extend/plugins.md +++ b/docs/extend/plugins.md @@ -14,7 +14,7 @@ Multiple plugins are supported: ### Reporting Plugins -InvenTree can generate customized reports (for example stocktake information, packing lists, acceptance test reports, etc). The reporting interface is extremely versatile, allowing the generation of reports in multiple formats (PDF / LaTeX / etc). +InvenTree can generate customized reports (for example stocktake information, packing lists, acceptance test reports, etc). !!! missing "TODO" Include more information here on reporting plugins diff --git a/docs/releases/0.1.6.md b/docs/releases/0.1.6.md index 9150696..9ca8351 100644 --- a/docs/releases/0.1.6.md +++ b/docs/releases/0.1.6.md @@ -8,6 +8,17 @@ title: v0.1.5 ## New Features +### Report Templates + +Support for report templates has been greatly improved, moving towards "out of the box" support for various reports. + +[#1270](https://github.com/inventree/InvenTree/pull/1270) represents a significant refactor of code, and tooling for report functionality. + +Refer to the [report documentation](../../report/report) for further information. + +!!! warning "LaTeX Support" + LaTeX report templates are no longer supported. + ## Major Bug Fixes | PR | Description | | --- | --- | diff --git a/docs/report/report.md b/docs/report/report.md index 6d5b568..4f4f5dc 100644 --- a/docs/report/report.md +++ b/docs/report/report.md @@ -6,62 +6,161 @@ title: Report Generation 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. +PDF reports are generated from custom HTML 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 +### WeasyPrint Templates -Following is a list of available report types +InvenTree report templates utilize the powerful [WeasyPrint](https://weasyprint.org/) PDF generation engine. -* [Test Report](../test): Format results of a test report against for a particular StockItem -* [Packing List](../pack): Format a list of items for shipping or transfer -* [Order List](../order): Order line items +!!! info "WeasyPrint" + WeasyPrint is an extremely powerful and flexible reporting library. Refer to the [WeasyPrint docs](https://weasyprint.readthedocs.io/en/stable/) for further information. -## Template Formats +### Stylesheets -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. +Templates are rendered using standard HTML / CSS - if you are familiar with web page layout, you're ready to go! + +### Template Language + +Uploaded report template files are passed through the [django template rendering framework](https://docs.djangoproject.com/en/dev/topics/templates/), and as such accept the same variable template strings as any other django template file. Different variables are passed to the report template (based on the context of the report) and can be used to customize the contents of the generated PDF. + +### Variables + +Each report template is provided a set of *context variables* which can be used when rendering the template. 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 \}\}**.* +```html +{% raw %} + + +
+ Description:
+ {{ part.description }}
+
+
+
+
+
+{% endraw %}
+```
+
+!!! warning "Asset Naming"
+ If the requested asset name does not match the name of an uploaded asset, the template will continue without loading the image.
+
+## Report Snippets
+
+A powerful feature provided by the django / WeasyPrint templating framework is the ability to include external template files. This allows commonly used template features to be broken out into separate files and re-used across multiple templates.
+
+To support this, InvenTree provides report "snippets" - short (or not so short) template files which cannot be rendered by themselves, but can be called from other templates.
+
+Similar to assets files, snippet template files are uploaded via the admin interface.
+
+Snippets are included in a template as follows:
+
+```
+{% raw %}{% include 'snippets/| {{ item.part.full_name }} | +{{ item.quantity }} | +