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

Merge pull request #61 from SchrodingersGat/build-report

Build report
This commit is contained in:
Oliver 2021-02-16 22:17:09 +11:00 committed by GitHub
commit 7d712340a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 53 additions and 6 deletions

View File

@ -24,6 +24,8 @@ 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.
## Major Bug Fixes ## Major Bug Fixes
| PR | Description | | PR | Description |
| --- | --- | | --- | --- |

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

@ -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

@ -74,6 +74,7 @@ nav:
- 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 - Labels: report/labels.md
- Admin: - Admin: