2
0
mirror of https://github.com/inventree/inventree-docs.git synced 2025-04-28 05:36:46 +00:00

Merge remote-tracking branch 'inventree/master'

This commit is contained in:
Oliver Walters 2021-02-22 17:33:26 +11:00
commit 81f1d2ca1e
29 changed files with 563 additions and 84 deletions

View File

@ -4,5 +4,88 @@ title: Importing Data
## Importing Data ## Importing Data
!!! missing "TODO" External data can be imported via the admin interface, allowing for rapid integration of existing datasets, or bulk editing of table data.
This section requires further work
!!! danger "Danger"
Uploading bulk data directly is a non-reversible action.
!!! warning "Backup"
Ensure you have made a backup of your database before performing bulk data import.
!!! warning "Supported Models"
Not all models in the InvenTree database support bulk import actions.
When viewing a model (which supports bulk data import) in the admin interface, select the "Import" button in the top-right corner:
{% with id="import", url="admin/import.png", description="Data import" %}
{% include 'img.html' %}
{% endwith %}
The next screen displays a list of column headings which are expected to be present in the uploaded data file.
{% with id="import_upload", url="admin/import_upload.png", description="Data upload" %}
{% include 'img.html' %}
{% endwith %}
Select the data file to import, and the data format. Press the "Submit" button to upload the file.
### File Format
The uploaded data file must meet a number of formatting requirements for successful data upload. A simple way of ensuring that the file format is correct is to first [export data](../export) for the model in question, and delete all data rows (not the header row) from the exported data file.
Then, the same file can be used as a template for uploading more data to the server.
### ID Field
The uploaded data file requires a special field called `id`. This `id` field uniquely identifies each entry in the database table(s) - it is also known as a *primary key*.
The `id` column **must** be present in an uploaded data file, as it is required to know how to process the incoming data.
Depending on the value of the `id` field in each row, InvenTree will attempt to either insert a new record into the database, or update an existing one.
#### Empty ID
If the `id` field in a given data row is empty (blank), then InvenTree interprets that particular row as a *new* entry which will be inserted into the database.
If you wish for a new database entry to be created for a particular data row, the `id` field **must** be left blank for that row.
#### Non-Empty ID
If the `id` field in a given data row is *not* empty, then InvenTree inteprets that particular row as an *existing* row to override / update.
In this case, InvenTree will search the database for an entry with the matching `id`. If a matching entry is found, then the entry is updated with the provided data.
However, if an entry is *not* found with the matching `id`, InvenTree will return an error message, as it cannot find the matching database entry to update.
!!! warning "Check id Value"
Exercise caution when uploading data with the `id` field specified!
### Import Preview
After the data file has been uploaded and validated, the user is presented with a *preview* screen, showing the records that will be inserted or updated in the database.
Here the user has a final chance to review the data upload.
Press the *Confirm Import* button to actually perform the import process and commit the data into the database.
{% with id="import_preview", url="admin/import_preview.png", description="Data upload preview" %}
{% include 'img.html' %}
{% endwith %}
Note that *new* records are automatically assigned an `id` value.
## Import Errors
Manually importing data in a relational database is a complex process. You may be presented with an error message which describes why the data could not be imported.
The error message should contain enough information to manually edit the data file to fix the problem.
Any error messages are displayed per row, and you can hover the mouse over the particular error message to view specific error details:
{% with id="import_error", url="admin/import_error.png", description="Data upload error" %}
{% include 'img.html' %}
{% endwith %}
!!! info "Report Issue"
If the error message does not provide enough information, or the error seems like a bug caused by InvenTree itself, report an [issue on Github](https://github.com/inventree/inventree/issues).

View File

@ -4,5 +4,43 @@ title: InvenTree Mobile App
## InvenTree Mobile App ## InvenTree Mobile App
!!! note "Work In Progress" The InvenTree Mobile App brings stock control to your pocket. Integrating seamlessly with the [InvenTree API](../../extend/api), the app provides immediate access to inventory data without requiring physical access to a computer.
InvenTree app documentation will be available soon.
Native barcode support provides a multitude of context-sensitive stock control actions, allowing streamlined inventory management at your fingertips.
## Download
### Android
The InvenTree App can be downloaded for Android devices via the [Play Store](https://play.google.com/store/apps/details?id=inventree.inventree_app).
### iOS
!!! missing "Not Yet Available"
The InvenTree app is not yet available for iOS devices
## Connect to InvenTree
Use of the InvenTree app assumes that you (the user) have access to an InvenTree server.
!!! success "Profiles"
The app supports multiple user profiles, providing simple switching between different InvenTree servers and/or account profiles.
!!! todo "Add Screenshot"
Add screenshot of "Profiles" screen
!!! todo "Add Screenshot"
Add screenshot of "connection failed" screen
!!! todo "Add Screenshot"
Add screenshow of "connection success" screen
## Index Page
!!! todo "TODO"
This section requires further work
## Menu Bar
!!! todo "TODO"
This section requires further work

31
docs/app/barcode.md Normal file
View File

@ -0,0 +1,31 @@
---
title: App Barcode Support
---
## Barcode Support
One of the key elements of functionality provided by the InvenTree app is the native support for context-sensitive barcode scanning.
Barcode integration allows extremely efficient stock control, for information lookup and also performing various actions.
### Supported Codes
The following code types are known to be supported
**1D Codes**
- Code-39
- Code-93
- Code-128
- ITF
**2D Codes**
- QR Code
- Data Matrix
- Aztec
## Actions
!!! todo "TODO"
This section requires further work

13
docs/app/issues.md Normal file
View File

@ -0,0 +1,13 @@
---
title: App Suggestions / Issues
---
## Suggestions / Issues
To suggest an improvement or new feature for the InvenTree app, or to report an issue, refer to the [InvenTree GitHub page](https://github.com/inventree/inventree/issues).
Suggestions or issues related to the InvenTree app will be tagged with the `app` label, and can be viewed here:
[https://github.com/inventree/InvenTree/issues?q=is:open+is:issue+label:app](https://github.com/inventree/InvenTree/issues?q=is%3Aopen+is%3Aissue+label%3Aapp)
General feedback on the app is also welcomed - if you have any ideas on how to make the app more functional or effective, please let us know!

38
docs/app/part.md Normal file
View File

@ -0,0 +1,38 @@
---
title: Part Views
---
## InvenTree App Part Views
!!! todo "TODO"
This section requires further work
## Part
!!! todo "TODO"
This section requires further work
### Details
!!! todo "TODO"
This section requires further work
### Stock
!!! todo "TODO"
This section requires further work
## Part Category
!!! todo "TODO"
This section requires further work
### Details
!!! todo "TODO"
This section requires further work
### Parts
!!! todo "TODO"
This section requires further work

View File

@ -31,17 +31,6 @@ Pictures taken in the InvenTree app are not stored or distributed to any other s
The InvenTree app does not collect any information which could be used to personally identify the user(s) of the device onto which the app is installed. The InvenTree app does not collect any information which could be used to personally identify the user(s) of the device onto which the app is installed.
## Error Reporting
Error and crash reporting is handled using the [sentry.io](https://sentry.io) service. When an unexpected error occurs, the user is presented with an option to automatically upload an error report. This is to assist with improving the code quality of the InvenTree app.
In addition to the specific details of the error (stack trace data), the following context data are included in the error report:
- **Phone Model** - Information on particular phone model
- **App Version** - App version information
Note: No personally identifiable information is included in the error report upload.
## Third Party Access ## Third Party Access
Aside from error reporting using the sentry reporting service, the InvenTree app does not share any information with third parties. The InvenTree app does not share any information with third parties.

22
docs/app/stock.md Normal file
View File

@ -0,0 +1,22 @@
---
title: Stock Views
---
## InvenTree App Stock Views
!!! todo "TODO"
This section requires further work
## Stock Item
### Details
### Actions
## Stock Location
### Details
### Actions
## Search

17
docs/app/translation.md Normal file
View File

@ -0,0 +1,17 @@
---
title: App Translations
---
## Translation Support
The InvenTree app, much like the InvenTree web-based application, is designed to support multiple language translations.
As with the web application, translations are community contributed - if the app does not support your native language, contributions are very welcome!
## Contributing
Translation files for the InvenTree app are [available on GitHub](https://github.com/inventree/inventree-app-i18n/).
A Python helper script simplifies the translation process by presenting the user with words or phrases which require translation, one item at a time.
Full translation efforts, while appreciated, are not required. Please feel free to contribute as much as you can!

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -0,0 +1 @@
<mxfile host="app.diagrams.net" modified="2021-02-17T12:17:54.934Z" agent="5.0 (Windows)" etag="87DjzT5RRqVJtgo26s6S" version="14.3.2" type="device"><diagram id="pZJ5gzIsBflhyFRZTal-" name="Page-1">7Vpbb5swFP41SNvDJrCB0MeGdFukVevUqVufJhc7gQ5w5Di3/vqZYK4mlFYk7BKpUvHx/fs++5zjVoNutP3I0MK/ppiEGtDxVoMTDQDDBEBLfnS8Sy0jy0wNcxZg2agw3AZPRBp1aV0FmCwrDTmlIQ8WVaNH45h4vGJDjNFNtdmMhtVZF2hOFMOth0LV+j3A3E+tjqUX9k8kmPvZzIYuayKUNZaGpY8w3ZRM8EqDLqOUp1/R1iVhAl6GS9rvw4HafGGMxLxLh/vHn77r2uPp56/R4+Qp8qZw/U6OskbhSm74G4kWIeJEWG8Q4+LXpVw/32WgMLqKMUnGNTQ43vgBJ7cL5CW1GyEDYfN5FMpqOQNhnGwPLt3IARFKIjQinO1EE9kBOhJDKaKsuCkYMTKY/RIbtrQhKYJ5PnKBk/iQUL0ANqDApgE7FLOOcbAWn/Pk8w6xAMUJguOsVkxWajA4rqCGK9CHBhYqwBYouoPjZf5xeJkteE0Gx6uuLwiGxstuOLg1kEiMLxPHIUpeiJbLwKviQrYB/yG+9ffAksX7UtUk2bueFXZZIRarT3tZWfG+XFd025eyfunqCFacVI0CsQO6Yh55/qrniM0Jf+5uUyktUWY1MJbZGBHOI1hXl9tEo5zhhgZ7sWYnTK8qxoQ1JaTblL3K3q4+kFWTnlMbKMVBGWivqnzbrxfaqE+hjf5JocGz0HoQmtOn0LrrrEe9gI56Mc966UEvF4pexl+uhWHKSZQE+wIZ/c009gkT0QF+2xJD6M/HELMgDF0aUrbvCzEiziwR35Iz+ouUamzPIQ+zfqIOC1QRbsoW7AalgGMFHVku254uVGnIWzywIl14YRLRgaAjwG0YHYO84+GtZrUNeOcaTxK0+hHoH+lBjkLORVsA3nRrHo+bJn915kY7kEyelhvVN/yn3Ni1Ow003Wkn5QZ0utMqfIwVV34Kj1LnyyIONpv4csADtO0jnSU4OF/gzNcL/JI1OF9tL49XLRAP85JmmkO/pAH16VFBacjEc6hEEcILsZvWDK9rqqgOldN+omQRWOeIoPnGajyAp72xmt6yzx7mEF+jwflqehJu58s1TsNQD3grEXNXB3U8vDtlmhW8J38P3oZZi6C6/k38FXiLYvFvCqlrKf7ZA179Bg==</diagram></mxfile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

70
docs/build/bom.md vendored
View File

@ -6,6 +6,76 @@ title: Bill of Materials
A Bill of Materials (BOM) defines the list of component parts required to make an assembly, [create builds](../build) and allocate inventory. A Bill of Materials (BOM) defines the list of component parts required to make an assembly, [create builds](../build) and allocate inventory.
A part which can be built from other sub components is called an *Assembly*.
## BOM Line Items
A BOM for a particular assembly is comprised of a number (zero or more) of BOM "Line Items", each of which has the following properties:
| Property | Description |
| --- | --- |
| Part | A reference to another *Part* object which is required to build this assembly |
| Quantity | The quantity of *Part* required for the assembly |
| Reference | Optional reference field to describe the BOM Line Item, e.g. part designator |
| Overage | Estimated losses for a build. Can be expressed as absolute values (e.g. 1, 7, etc) or as a percentage (e.g. 2%) |
| Inherited | A boolean field which indicates whether this BOM Line Item will be "inherited" by BOMs for parts which are a variant (or sub-variant) of the part for which this BOM is defined. |
| Optional | A boolean field which indicates if this BOM Line Item is "optional" |
| Note | Optional note field for additional information
!!! missing "Overage"
While the overage field exists, it is currently non-functional and has no effect on BOM operation
!!! missing "Optional"
The Optional field is currently for indication only - it does not serve a functional purpose (yet)
### Inherited BOM Line Items
When using the InvenTree [template / variant](../../part/template) feature, it may be useful to make use of the *inheritance* capability of BOM Line Items.
If a BOM Line Item is designed as *Inherited*, it will be automatically included in the BOM of any part which is a variant (or sub-variant) of the part for which the BOM Line Item is defined.
This is particulary useful if a template part is defined with the "common" BOM items which exist for all variants of that template.
Consider the example diagram below:
{% with id="inherited_bom", url="build/inherited_bom.png", description="Inherited BOM Line Items" %}
{% include 'img.html' %}
{% endwith %}
**Template Part A** has two BOM line items defined: *A1* and *A2*.
- *A1* is inherited by all variant parts underneath *Template Part A*
- *A2* is not inherited, and is only included in the BOM for *Template Part A*
**Variant B** has two line items:
- *A1* is inherited from parent part *A*
- *B1* is defined for part *B* (and is also defined as an inherited BOM Line Item)
**Variant C**
- *A1* inherited from *A*
- *C1* defined for *C*
**Variant D**
- *A1* inherited from *A*
- *B1* inherited from *B*
- *D1* defined for *D*
**Variant E**
- Well, you get the idea.
Note that inherited BOM Line Items only flow "downwards" in the variant inheritance chain. Parts which are higher up the variant chain cannot inherit BOM items from child parts.
!!! info "Editing Inherited Items"
When editing an inherited BOM Line Item for a template part, the changes are automatically reflected in the BOM of any variant parts.
## BOM Creation
BOMs can be created manually, by adjusting individual line items, or by upload an existing BOM file.
### Add BOM Item ### Add BOM Item
To manually add a BOM item, navigate to the part/assembly detail page then click on the "BOM" tab. On top of the tab view, click on the <span class='fas fa-edit'></span> icon then, after the page reloads, click on the <span class='fas fa-plus-circle'></span> icon. To manually add a BOM item, navigate to the part/assembly detail page then click on the "BOM" tab. On top of the tab view, click on the <span class='fas fa-edit'></span> icon then, after the page reloads, click on the <span class='fas fa-plus-circle'></span> icon.

View File

@ -1,39 +0,0 @@
---
title: Future Features
---
## Future Features
An non-exhaustive list of feature proposals from InvenTree users.
!!! warning "Disclaimer"
**There is no guarantee that any of those feature will be integrated into InvenTree.**
If you would like to see them implemented, make your voice heard :)
### General
| Feature | Link(s) |
| ----------- | ----------- |
| Barcodes / QR Codes | [#853](https://github.com/inventree/InvenTree/issues/853) [#708](https://github.com/inventree/InvenTree/issues/708) [#677](https://github.com/inventree/InvenTree/issues/677) |
| History tracking | [#547](https://github.com/inventree/InvenTree/issues/547) [#537](https://github.com/inventree/InvenTree/issues/537) [#377](https://github.com/inventree/InvenTree/issues/377) |
| "Copy to clipboard" function | [#997](https://github.com/inventree/InvenTree/issues/997) [#725](https://github.com/inventree/InvenTree/issues/725) |
| "Comments" support | [#868](https://github.com/inventree/InvenTree/issues/868) |
### Part
| Feature | Link(s) |
| ----------- | ----------- |
| Part Ownership and Lending | [#656](https://github.com/inventree/InvenTree/issues/656) |
### Build
| Feature | Link(s) |
| ----------- | ----------- |
| Add ability to modify a completed build | [#977](https://github.com/inventree/InvenTree/issues/977) |
| Partial build completion | [#572](https://github.com/inventree/InvenTree/issues/572) |
### Orders
| Feature | Link(s) |
| ----------- | ----------- |
| Receiving order and allocating | [#551](https://github.com/inventree/InvenTree/issues/551) |

View File

@ -51,7 +51,7 @@ If a part is designated as a *Component* it can be used as a sub-component of an
Trackable parts can be assigned batch numbers or serial numbers which uniquely identify a particular stock item. Trackable parts also provide other features (and restrictions) in the InvenTree ecosystem. Trackable parts can be assigned batch numbers or serial numbers which uniquely identify a particular stock item. Trackable parts also provide other features (and restrictions) in the InvenTree ecosystem.
[Read further information about trackable parts here](/../trackable). [Read further information about trackable parts here](../trackable).
### Purchaseable ### Purchaseable
@ -63,4 +63,4 @@ If a part is designated as *Salable* it can be sold to external customers. Setti
### Active ### Active
By default, all parts are *Active*. Marking a part as inactive means it is not available for many actions, but the part remains in the database. If a part becomes obsolete, it is recommended that it is marked as inactive, rather than deleting it from the database. By default, all parts are *Active*. Marking a part as inactive means it is not available for many actions, but the part remains in the database. If a part becomes obsolete, it is recommended that it is marked as inactive, rather than deleting it from the database.

View File

@ -1,5 +1,5 @@
--- ---
title: v0.1.4 title: Release 0.1.4
--- ---
## Release 0.1.4 ## Release 0.1.4

View File

@ -1,5 +1,5 @@
--- ---
title: v0.1.5 title: Release 0.1.5
--- ---
## Release 0.1.5 ## Release 0.1.5

View File

@ -1,10 +1,10 @@
--- ---
title: v0.1.5 title: Release 0.1.6
--- ---
## Release 0.1.6 ## Release 0.1.6
[Release 0.1.5](https://github.com/inventree/InvenTree/releases/tag/0.1.5) (Febuary 2021) provides a number of major new features and improvements, as well as some crucial bug fixes: [Release 0.1.6](https://github.com/inventree/InvenTree/releases/tag/0.1.6) (Febuary 2021) provides a number of major new features and improvements, as well as some crucial bug fixes:
## New Features ## New Features
@ -24,6 +24,22 @@ Refer to the [report documentation](../../report/report) for further information
!!! warning "LaTeX Support" !!! warning "LaTeX Support"
LaTeX report templates are no longer supported for a number of technical and ideological reasons LaTeX report templates are no longer supported for a number of technical and ideological reasons
[#1292](https://github.com/inventree/InvenTree/pull/1292) adds support for build order / work order reports. Refer to the [build report documentation](../../report/build) for further information.
### Inherited BOM Items
[#1313](https://github.com/inventree/InvenTree/pull/1313) adds support for inherited BOM items, allowing greater flexibility for Bill of Materials management when combined with the Template / Variant part system.
Refer to the [BOM documentation](../../build/bom) for further information.
### Stock Item Packaging
[#1329](https://github.com/inventree/InvenTree/pull/1329) adds a *packaging* field to the StockItem model, so the particular packaging information (e.g. tape / reel / loose / etc) can be captured per stock item.
### Visual Improvements
[#1333](https://github.com/inventree/InvenTree/pull/1333) provides a significant overhaul of the visual style of the "index" and "search" pages.
## Major Bug Fixes ## Major Bug Fixes
| PR | Description | | PR | Description |
| --- | --- | | --- | --- |
@ -33,3 +49,4 @@ Refer to the [report documentation](../../report/report) for further information
| [#1289](https://github.com/inventree/InvenTree/pull/1289) | Fixes display bug when a part "units" field is empty | | [#1289](https://github.com/inventree/InvenTree/pull/1289) | Fixes display bug when a part "units" field is empty |
| [#1290](https://github.com/inventree/InvenTree/pull/1290) | Fixes CSS issues with long error messages in modal forms | | [#1290](https://github.com/inventree/InvenTree/pull/1290) | Fixes CSS issues with long error messages in modal forms |
| [#1294](https://github.com/inventree/InvenTree/pull/1294) | Allows access to static files without being logged in | | [#1294](https://github.com/inventree/InvenTree/pull/1294) | Allows access to static files without being logged in |
| [#1320](https://github.com/inventree/InvenTree/pull/1320) | Fixes "Used In" display for parts that are referenced in inerited BOMs |

23
docs/releases/0.1.7.md Normal file
View File

@ -0,0 +1,23 @@
---
title: Release 0.1.7
---
## Release 0.1.7
[Release 0.1.7](https://github.com/inventree/InvenTree/releases/tag/0.1.7) (WIP) provides a number of major new features and improvements, as well as some crucial bug fixes:
## New Features
### Label Printing
Label printing functionality has been simplified and brought into line with the PDF reporting functionality.
[#1342](https://github.com/inventree/InvenTree/pull/1342) represents a significant refactor of the label printing code.
!!! info "More Information"
Refer to the [label printing documentation](../../report/labels) for further details.
## Major Bug Fixes
| PR | Description |
| --- | --- |
| [#1341](https://github.com/inventree/InvenTree/pull/1341) | Fixes display issue with Part variant table |

View File

@ -8,6 +8,16 @@ For information on the latest and greatest InvenTree features, refer to the rele
| Release | Date | | Release | Date |
| ------- | ---- | | ------- | ---- |
| 0.1.6 | *In Development* | | [0.1.7](../0.1.7) | *In Development* |
| [0.1.6](../0.1.6) | February 2021 |
| [0.1.5](../0.1.5) | January 2021 | | [0.1.5](../0.1.5) | January 2021 |
| [0.1.4](../0.1.4) | November 2020 | | [0.1.4](../0.1.4) | November 2020 |
## Upcoming Features
In-progress and upcoming features can be viewed on [GitHub](https://github.com/inventree/inventree/pulls), where the InvenTree source code is hosted.
## Suggest Something New
To suggest a new feature (or report a bug) raise an [issue on GitHub](https://github.com/inventree/inventree/issues).

64
docs/report/barcodes.md Normal file
View File

@ -0,0 +1,64 @@
---
title: Barcode Generation
---
## Barcode Generation
Both [report](../report) and [label](../labels) templates can render custom barcode data to in-line images.
!!! info "img"
Barcode data must be rendered inside an `<img>` tag.
Inside the template file (whether it be for printing a label or generating a custom report), the following code will need to be included at the top of the template file:
```html
{% raw %}
<!-- Load the barcode helper functions -->
{% load barcode %}
{% endraw %}
```
### 1D Barcode
!!! info "python-barcode"
One dimensional barcodes (e.g. Code128) are generated using the [python-barcode](https://pypi.org/project/python-barcode/) library.
To render a 1D barcode, use the `barcode` template tag, as shown in the example below:
```html
{% raw %}
<!-- Don't forget to load the barcode helper! -->
{% load barcode %}
<img class='custom_class' src='{% barcode "12345678" %}'>
{% endraw %}
```
The default barcode renderer will generate a barcode using [Code128](https://en.wikipedia.org/wiki/Code_128) rendering. However [other barcode formats](https://python-barcode.readthedocs.io/en/stable/codes.html) are also supported:
```html
{% raw %}
{% load barcode %}
<img class='custom_class' src='{% barcode "12345678" barcode_class="Code39" %}>
{% endraw %}
```
### QR-Code
!!! info "qrcode"
Two dimensional QR codes are generated using the [qrcode](https://pypi.org/project/qrcode/) library.
To render a QR code, use the `qrcode` template tag:
```html
{% raw %}
{% load barcode %}
<img class='custom_qr_class' src='{% qrcode "Hello world!" %}'>
{% endraw %}
```

24
docs/report/build.md Normal file
View File

@ -0,0 +1,24 @@
---
title: Build Order Report
---
## Build Order Report
Custom build order reports may be generated against any given Build Order. For example, build order reports can be used to generate work orders.
### Build Filters
!!! missing "TODO"
This section rquires further work
### Context Variables
In addition to the default report context variables, the following context variables are made available to the build order report template for rendering:
| Variable | Description |
| --- | --- |
| build | The build object the report is being generated against |
| part | The part object that the build references |
| reference | The build order reference string |
| quantity | Build order quantity |

View File

@ -4,18 +4,16 @@ title: Custom Labels
## Custom Labels ## Custom Labels
InvenTree supports printing of custom template-based labels, using the [blabel](https://github.com/Edinburgh-Genome-Foundry/blabel) Python library. InvenTree supports printing of custom template-based labels, using the [WeasyPrint](https://weasyprint.org/) PDF generation engine.
Custom labels can be generated using simple HTML templates, with support for QR-codes, and conditional formatting using the Jinja template engine. 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](https://edinburgh-genome-foundry.github.io/blabel/) for further information, and examples of the available features
Simple (generic) label templates are supplied 'out of the box' with InvenTree - however support is provided for generation of extremely specific custom labels, to meet any particular requirement. Simple (generic) label templates are supplied 'out of the box' with InvenTree - however support is provided for generation of extremely specific custom labels, to meet any particular requirement.
## Label Templates ## Label Templates
Label templates are written using a mixture of [HTML](https://www.w3schools.com/html/) and [CSS](https://www.w3schools.com/css). The blabel library is based on [weasyprint](https://weasyprint.org/), which supports a *subset* of HTML and CSS features. In addition to supporting HTML and CSS formatting, the label templates support the Jinja templating engine, allowing conditional formatting of the label data. Label templates are written using a mixture of [HTML](https://www.w3schools.com/html/) and [CSS](https://www.w3schools.com/css). [Weasyprint](https://weasyprint.org/) templates support a *subset* of HTML and CSS features. In addition to supporting HTML and CSS formatting, the label templates support the Jinja templating engine, allowing conditional formatting of the label data.
A label template is a single `.html` file which is uploaded to the InvenTree server by the user. A label template is a single `.html` file which is uploaded to the InvenTree server by the user.
@ -29,8 +27,7 @@ Below is a reasonably simple example of a label template which demostrates much
{% raw %} {% raw %}
<style> <style>
@page { @page {
width: 75mm; size: 75mm 24mm;
height: 24mm;
padding: 1mm; padding: 1mm;
} }
@ -59,7 +56,7 @@ Below is a reasonably simple example of a label template which demostrates much
</style> </style>
<img class='qr' src="{{ label_tools.qr_code(location.barcode) }}"/> <img class='qr' src="{% qrcode location.format_barcode %}"/>
<div class='location'> <div class='location'>
{{ location.name }} {{ location.name }}
@ -99,11 +96,9 @@ Location Name: {{ location.name }}
{% endraw %} {% endraw %}
``` ```
### QR Codes ### Barcodes
`blabel` supports barcodes and QR codes 'out of the box'. Passing data to render as a barcode or QR code is handled in the template file itself. Refer to the [barcode documentation](../barcodes).
Refer to the [blabel docs](https://edinburgh-genome-foundry.github.io/blabel/) for further information.
### Conditional Formatting ### Conditional Formatting
@ -127,10 +122,67 @@ As an example, consider a label template for a StockItem. A user may wish to def
To restrict the label accordingly, we could set the *filters* value to `part__IPN=IPN123`. To restrict the label accordingly, we could set the *filters* value to `part__IPN=IPN123`.
### Built-In Templates ## Built-In Templates
The InvenTree installation provides a number of simple *default* templates which can be used as a starting point for creating custom labels. These built-in templates can be disabled if they are not required. The InvenTree installation provides a number of simple *default* templates which can be used as a starting point for creating custom labels. These built-in templates can be disabled if they are not required.
Built-in templates can also be used to quickly scaffold custom labels, using template inheritance.
### Base Template
For example, InvenTree provides a *base* template from which all of the default label templates are derived. This *base* template provides the essentials for generating a label:
```html
{% raw %}
<head>
<style>
@page {
size: {{ width }}mm {{ height }}mm;
{% block margin %}
margin: 0mm;
{% endblock %}
}
img {
display: inline-block;
image-rendering: pixelated;
}
{% block style %}
{% endblock %}
</style>
</head>
<body>
{% block content %}
<!-- Label data rendered here! -->
{% endblock %}
</body>
{% endraw %}
```
### Extend Base Template
To extend this template in a custom uploaded label, simply extend as follows:
```html
{% raw %}
{% extends "label/label_base.html" %}
{% block style %}
<!-- You can write custom CSS here -->
{% endblock %}
{% block content %}
<!-- HTML content goes here! -->
{% endblock %}
{% 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.

View File

@ -48,6 +48,24 @@ For example, rendering the name of a part (which is available in the particular
!!! info "Variables" !!! 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. Templates will have different variables available to them depending on the report type. Read the detail information on each report type for further information.
### Context Data
Each report has access to a number of context variables by default. The following context variables are provided to every report template:
| Variable | Description |
| --- | --- |
| date | Current date, represented as a Python datetime.date object |
| datetime | Current datetime, represented as a Python datetime object |
| default_page_size | InvenTree default page size variable |
| report_name | Name of the report template |
| report_description | Description of the report template |
| report_revision | Revision of the report template |
| request | Django request object |
| user | User who made the request to render the template |
!!! info "Specific Report Context"
Specific report types may have additional context variables
### Conditional Rendering ### Conditional Rendering
The django template system allows for conditional rendering, providing conditional flow statements such as `{% raw %}{% if <condition> %}{% endraw %}`, `{% raw %}{% for <item> in <list> %}{% endraw %}`, etc. The django template system allows for conditional rendering, providing conditional flow statements such as `{% raw %}{% if <condition> %}{% endraw %}`, `{% raw %}{% for <item> in <list> %}{% endraw %}`, etc.
@ -182,7 +200,7 @@ InvenTree supports the following reporting functionality:
### Build Report ### Build Report
Build Report: TODO [Build Order](../build): Format a build order report
### Purchase Order ### Purchase Order
[Purchase Order report](../order): Order line items [Purchase Order report](../order): Order line items

View File

@ -27,12 +27,14 @@ In the example below, a test report template is uploaded and assigned to the par
### Context Variables ### Context Variables
The following context variables are made available to the TestReport template for rendering: In addition to the default report 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 | Variable | Description |
- **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) | stock_item | The individual stock item for which this test report is being generated |
- **result_list**: A list of each test result object | 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 #### Results

View File

@ -132,7 +132,7 @@ For further information, refer to the following documentation:
### Static File Storage ### Static File Storage
By default, static files are stored in the local directory `./inventree_media`. This directory should be changed by specifying the `static_root` option in the config file based on the particular installation requirements. By default, static files are stored in the local directory `./inventree_static`. This directory should be changed by specifying the `static_root` option in the config file based on the particular installation requirements.
Alternatively this location can be specified with the `INVENTREE_STATIC_ROOT` environment variable. Alternatively this location can be specified with the `INVENTREE_STATIC_ROOT` environment variable.

View File

@ -71,11 +71,13 @@ nav:
- Sales Orders: companies/so.md - Sales Orders: companies/so.md
- Report: - Report:
- Templates: report/report.md - Templates: report/report.md
- Labels: report/labels.md
- Reports: - Reports:
- Test Reports: report/test.md - Test Reports: report/test.md
- Packing List: report/pack.md - Packing List: report/pack.md
- Build Order: report/build.md
- Order: report/order.md - Order: report/order.md
- Labels: report/labels.md - Barcodes: report/barcodes.md
- Admin: - Admin:
- Admin Interface: admin/admin.md - Admin Interface: admin/admin.md
- User Permissions: admin/permissions.md - User Permissions: admin/permissions.md
@ -89,10 +91,14 @@ nav:
- Plugins: extend/plugins.md - Plugins: extend/plugins.md
- Themes: extend/themes.md - Themes: extend/themes.md
- Third-Party: extend/integrate.md - Third-Party: extend/integrate.md
- Future Features: extend/future.md
- App: - App:
- App: app/app.md - InvenTree App: app/app.md
- Barcodes: app/barcode.md
- Parts: app/part.md
- Stock: app/barcode.md
- Privacy: app/privacy.md - Privacy: app/privacy.md
- Translation: app/translation.md
- Suggestions: app/issues.md
# Plugins # Plugins
plugins: plugins: