2
0
mirror of https://github.com/inventree/inventree-docs.git synced 2025-06-14 19:25:37 +00:00

Return orders (#459)

* Add page for return orders

* Add some intro patter, images

* More docs and images

* Add page for return order reports

* Add doc for return order report functionality

* Updates for report docs

* Updates
This commit is contained in:
Oliver
2023-03-29 20:46:45 +11:00
committed by GitHub
parent 23f4399119
commit b4985d21eb
21 changed files with 275 additions and 116 deletions

View File

@ -3,9 +3,22 @@ title: BOM Generation
---
## BOM Generation
The bill of materials is an essential part of the documentation that needs to be sent to the factory. A simple csv export is OK to be important into SMT machines. But for human readable documentation it might not be sufficient. Additional information is needed. The Inventree report system allows to generate BOM well formatted BOM reports.
### A simple example
### Context variables
| Variable | Description |
| --- | --- |
| bom_items | Query set that contains all BOM items |
| bom_items...sub_part | One component of the BOM |
| bom_items...quantity | Number of parts |
| bom_items...reference | Reference designators of the part |
| bom_items...substitutes | Query set that contains substitutes of the part if any exist in the BOM |
### Examples
#### BOM
The following picture shows a simple example for a PCB with just three components from two different parts.
{% with id="report-options", url="report/bom_example.png", description="BOM example" %} {% include 'img.html' %} {% endwith %}
@ -103,11 +116,71 @@ table td {
{% endraw %}
```
### Context variables
| Variable | Description |
| --- | --- |
| bom_items | Query set that contains all BOM items |
| bom_items...sub_part | One component of the BOM |
| bom_items...quantity | Number of parts |
| bom_items...reference | Reference designators of the part |
| bom_items...substitutes | Query set that contains substitutes of the part if any exist in the BOM |
#### Pick List
When all material has been allocated someone has to pick all things from the warehouse.
In case you need a printed pick list you can use the following template. This it just the
table. All other info and CSS has been left out for simplicity. Please have a look at the
BOM report for details.
{% raw %}
```html
<table class='changes-table'>
<thead>
<tr>
<th>Original IPN</th>
<th>Allocated Part</th>
<th>Location</th>
<th>PCS</th>
</tr>
</thead>
<tbody>
{% for line in build.allocated_stock.all %}
<tr>
<td> {{ line.bom_item.sub_part.IPN }} </td>
{% if line.stock_item.part.IPN != line.bom_item.sub_part.IPN %}
<td class='chg'> {{ line.stock_item.part.IPN }} </td>
{% else %}
<td> {{ line.stock_item.part.IPN }} </td>
{% endif %}
<td> {{ line.stock_item.location.pathstring }} </td>
<td> {{ line.quantity }} </td>
</tr>
{% endfor %}
</tbody>
</table>
```
{% endraw %}
Here we have a loop that runs through all allocated parts for the build. For each part
we list the original IPN from the BOM and the IPN of the allocated part. These can differ
in case you have substitutes or template/variants in the BOM. In case the parts differ
we use a different format for the table cell e.g. print bold font or red color.
For the picker we list the full path names of the stock locations and the quantity
that is needed for the build. This will result in the following printout:
{% with id="report-options", url="report/picklist.png", description="Picklist Example" %} {% include "img.html" %} {% endwith %}
For those of you who would like to replace the "/" by something else because it is hard
to read in some fonts use the following trick:
{% raw %}
```html
<td> {% for loc in line.stock_item.location.path %}{{ loc.name }}{% if not forloop.last %}-{% endif %}{% endfor %} </td>
```
{% endraw %}
Here we use location.path which is a query set that contains the location path up to the
topmost parent. We use a loop to cycle through that and print the .name of the entry followed
by a "-". The foorloop.last is a Django trick that allows us to not print the "-" after
the last entry. The result looks like here:
{% with id="report-options", url="report/picklist_with_path.png", description="Picklist Example" %} {% include "img.html" %} {% endwith %}
Finally added a `{% raw %}|floatformat:0{% endraw %}` to the quantity that removes the trailing zeros.
### Default Report Template
A default *BOM Report* template is provided out of the box, which is useful for generating simple test reports. Furthermore, it may be used as a starting point for developing custom BOM reports:
View the [source code](https://github.com/inventree/InvenTree/blob/master/InvenTree/report/templates/report/inventree_bill_of_materials_report.html) for the default test report template.

View File

@ -6,11 +6,6 @@ title: 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 requires 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:
@ -293,3 +288,9 @@ This will result a report page like this:
{% with id="report-options", url="build/report-61.png", description="Report Example Builds" %} {% include "img.html" %} {% endwith %}
### Default Report Template
A default *Build Report* template is provided out of the box, which is useful for generating simple test reports. Furthermore, it may be used as a starting point for developing custom BOM reports:
View the [source code](https://github.com/inventree/InvenTree/blob/master/InvenTree/report/templates/report/inventree_build_order_base.html) for the default build report template.

View File

@ -114,10 +114,7 @@ Each part object has access to a lot of context variables about the part. The fo
### Stock
!!! incomplete "TODO"
This section requires further work
#### StockItem
#### Stock Item
| Variable | Description |
|----------|-------------|
@ -146,7 +143,7 @@ Each part object has access to a lot of context variables about the part. The fo
| purchase_price | The unit purchase price for this [StockItem](./context_variables.md#stockitem) - this is the unit price at time of purchase (if this item was purchased from an external supplier) |
| packaging | Description of how the StockItem is packaged (e.g. "reel", "loose", "tape" etc) |
#### StockLocation
#### Stock Location
| Variable | Description |
|----------|-------------|
@ -182,7 +179,7 @@ Each part object has access to a lot of context variables about the part. The fo
| currency_code | Default currency for the company |
| parts | Query set with all parts that the company supplies |
#### SupplierPart
#### Supplier Part
| Variable | Description |
|----------|-------------|
@ -218,41 +215,46 @@ Each part object has access to a lot of context variables about the part. The fo
| Variable | Description |
|----------|-------------|
### Orders
!!! incomplete "TODO"
This section requires further work
#### PurchaseOrder
#### Purchase Order
A [Purchase Order](../buy/po.md) object has the following context variables available.
| Variable | Description |
|----------|-------------|
| description | The order description |
| lines | The lines in the Purchase Order |
| order | The order object itself |
| reference | The reference number |
| supplier | The supplier for this Purchase Order |
| prefix | Purchase Order reference prefix |
| title | The title of the order |
#### SalesOrder
!!! incomplete "TODO"
This section requires further work
A [Sales Order](../sell/so.md) object has the following context variables available.
| Variable | Description |
|----------|-------------|
| customer | An object with information about the customer |
| description | The order description |
| lines | The lines in the Sales Order |
| order | The order object itself |
| prefix | Purchase Order reference prefix |
| reference | The reference number |
| title | The title of the order |
#### Return Order
A [Return Order](../sell/return.md) object has the following context variables avaiable.
| Variable | Description |
| --- | --- |
| customer | An object with information about the customer |
| description | The order description |
| lines | The lines in the Sales Order |
| reference | The reference number |
#### user
### User
| Variable | Description |
|----------|-------------|

View File

@ -1,71 +0,0 @@
---
title: Packing List Report
---
## Packing List
!!! missing "TODO"
This section requires further work
## Pick List
When all material has been allocated someone has to pick all things from the warehouse.
In case you need a printed pick list you can use the following template. This it just the
table. All other info and CSS has been left out for simplicity. Please have a look at the
BOM report for details.
{% raw %}
```html
<table class='changes-table'>
<thead>
<tr>
<th>Original IPN</th>
<th>Allocated Part</th>
<th>Location</th>
<th>PCS</th>
</tr>
</thead>
<tbody>
{% for line in build.allocated_stock.all %}
<tr>
<td> {{ line.bom_item.sub_part.IPN }} </td>
{% if line.stock_item.part.IPN != line.bom_item.sub_part.IPN %}
<td class='chg'> {{ line.stock_item.part.IPN }} </td>
{% else %}
<td> {{ line.stock_item.part.IPN }} </td>
{% endif %}
<td> {{ line.stock_item.location.pathstring }} </td>
<td> {{ line.quantity }} </td>
</tr>
{% endfor %}
</tbody>
</table>
```
{% endraw %}
Here we have a loop that runs through all allocated parts for the build. For each part
we list the original IPN from the BOM and the IPN of the allocated part. These can differ
in case you have substitutes or template/variants in the BOM. In case the parts differ
we use a different format for the table cell e.g. print bold font or red color.
For the picker we list the full path names of the stock locations and the quantity
that is needed for the build. This will result in the following printout:
{% with id="report-options", url="report/picklist.png", description="Picklist Example" %} {% include "img.html" %} {% endwith %}
For those of you who would like to replace the "/" by something else because it is hard
to read in some fonts use the following trick:
{% raw %}
```html
<td> {% for loc in line.stock_item.location.path %}{{ loc.name }}{% if not forloop.last %}-{% endif %}{% endfor %} </td>
```
{% endraw %}
Here we use location.path which is a query set that contains the location path up to the
topmost parent. We use a loop to cycle through that and print the .name of the entry followed
by a "-". The foorloop.last is a Django trick that allows us to not print the "-" after
the last entry. The result looks like here:
{% with id="report-options", url="report/picklist_with_path.png", description="Picklist Example" %} {% include "img.html" %} {% endwith %}
Finally added a |floatformat:0 to the quantity that removes the trailing zeros.

View File

@ -4,5 +4,13 @@ title: Purchase Order Report
## Purchase Order Reports
### Context Variables
!!! missing "TODO"
This section requires further work
### Default Report Template
A default *Purchase Order Report* template is provided out of the box, which is useful for generating simple test reports. Furthermore, it may be used as a starting point for developing custom BOM reports:
View the [source code](https://github.com/inventree/InvenTree/blob/master/InvenTree/report/templates/report/inventree_po_report_base.html) for the default purchase order report template.

View File

@ -144,6 +144,7 @@ InvenTree supports the following reporting functionality:
| [Build Order Report](./build.md) | Format a build order report |
| [Purchase Order Report](./purchase_order.md) | Format a purchase order report |
| [Sales Order Report](./sales_order.md) | Format a sales order report |
| [Return Order Report](./return_order.md) | Format a return order report |
## Report Options

View File

@ -0,0 +1,26 @@
---
title: Return Order Reports
---
## Return Order Reports
Custom reports may be generated against any given [Return Order](../sell/return.md). For example, return order reports can be used to generate an RMA request to send to a customer.
### Context Variables
In addition to the default report context variables, the following context variables are made available to the return order report template for rendering:
| Variable | Description |
| --- | --- |
| order | The return order object the report is being generated against |
| description | The description of the order, also accessed through `order.description` |
| reference | The reference of the order, also accessed through `order.reference` |
| customer | The customer object related to this order |
| lines | The list of line items linked to this order |
| extra_lines | The list of extra line items linked to this order |
### Default Report Template
A default report template is provided out of the box, which can be used as a starting point for developing custom return order report templates.
View the [source code](https://github.com/inventree/InvenTree/blob/master/InvenTree/report/templates/report/inventree_return_order_report_base.html) for the default return order report template.

View File

@ -4,5 +4,13 @@ title: Sales Order Reports
## Sales Order Reports
### Context Variables
!!! missing "TODO"
This section requires further work
### Default Report Template
A default *Sales Order Report* template is provided out of the box, which is useful for generating simple test reports. Furthermore, it may be used as a starting point for developing custom BOM reports:
View the [source code](https://github.com/inventree/InvenTree/blob/master/InvenTree/report/templates/report/inventree_so_report_base.html) for the default sales order report template.

View File

@ -4,15 +4,12 @@ title: Test Report
## Test Report
InvenTree provides [test result](../stock/test.md) tracking functionality which allows the users to keep track of any tests which have been performed on a given stock item.
InvenTree provides [test result](../stock/test.md) tracking functionality which allows the users to keep track of any tests which have been performed on a given [stock item](../stock/stock.md).
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.
@ -72,3 +69,13 @@ The *installed_items* context variable is a list of all [StockItem](./context_va
</table>
{% endraw %}
```
### Default Report Template
A default *Test Report* template is provided out of the box, which is useful for generating simple test reports. Furthermore, it may be used as a starting point for developing custom test reports:
{% with id="test-report-example", url="report/test_report_example.png", description="Example Test Report" %}
{% include "img.html" %}
{% endwith %}
View the [source code](https://github.com/inventree/InvenTree/blob/master/InvenTree/report/templates/report/inventree_test_report_base.html) for the default test report template.