diff --git a/docs/assets/images/report/report.png b/docs/assets/images/report/report.png
index 9bf1da6b..5c70464e 100644
Binary files a/docs/assets/images/report/report.png and b/docs/assets/images/report/report.png differ
diff --git a/docs/assets/images/report/test_report_example.png b/docs/assets/images/report/test_report_example.png
new file mode 100644
index 00000000..96770435
Binary files /dev/null and b/docs/assets/images/report/test_report_example.png differ
diff --git a/docs/assets/images/sell/return_order_create.png b/docs/assets/images/sell/return_order_create.png
new file mode 100644
index 00000000..b5f899da
Binary files /dev/null and b/docs/assets/images/sell/return_order_create.png differ
diff --git a/docs/assets/images/sell/return_order_detail.png b/docs/assets/images/sell/return_order_detail.png
new file mode 100644
index 00000000..64082dd2
Binary files /dev/null and b/docs/assets/images/sell/return_order_detail.png differ
diff --git a/docs/assets/images/sell/return_order_enable.png b/docs/assets/images/sell/return_order_enable.png
new file mode 100644
index 00000000..571ab319
Binary files /dev/null and b/docs/assets/images/sell/return_order_enable.png differ
diff --git a/docs/assets/images/sell/return_order_index.png b/docs/assets/images/sell/return_order_index.png
new file mode 100644
index 00000000..5e650d99
Binary files /dev/null and b/docs/assets/images/sell/return_order_index.png differ
diff --git a/docs/assets/images/sell/return_order_navbar.png b/docs/assets/images/sell/return_order_navbar.png
new file mode 100644
index 00000000..91604cda
Binary files /dev/null and b/docs/assets/images/sell/return_order_navbar.png differ
diff --git a/docs/report/bom.md b/docs/report/bom.md
index f656d255..0b9d0dfd 100644
--- a/docs/report/bom.md
+++ b/docs/report/bom.md
@@ -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
+
+
+
+ Original IPN |
+ Allocated Part |
+ Location |
+ PCS |
+
+
+
+ {% for line in build.allocated_stock.all %}
+
+ {{ line.bom_item.sub_part.IPN }} |
+ {% if line.stock_item.part.IPN != line.bom_item.sub_part.IPN %}
+ {{ line.stock_item.part.IPN }} |
+ {% else %}
+ {{ line.stock_item.part.IPN }} |
+ {% endif %}
+ {{ line.stock_item.location.pathstring }} |
+ {{ line.quantity }} |
+
+ {% endfor %}
+
+
+```
+{% 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
+ {% for loc in line.stock_item.location.path %}{{ loc.name }}{% if not forloop.last %}-{% endif %}{% endfor %} |
+```
+{% 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.
diff --git a/docs/report/build.md b/docs/report/build.md
index ce448be5..8f9770a6 100644
--- a/docs/report/build.md
+++ b/docs/report/build.md
@@ -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.
+
diff --git a/docs/report/context_variables.md b/docs/report/context_variables.md
index 9f7c369e..288ca904 100644
--- a/docs/report/context_variables.md
+++ b/docs/report/context_variables.md
@@ -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 |
|----------|-------------|
diff --git a/docs/report/pack.md b/docs/report/pack.md
deleted file mode 100644
index f598b23f..00000000
--- a/docs/report/pack.md
+++ /dev/null
@@ -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
-
-
-
- Original IPN |
- Allocated Part |
- Location |
- PCS |
-
-
-
- {% for line in build.allocated_stock.all %}
-
- {{ line.bom_item.sub_part.IPN }} |
- {% if line.stock_item.part.IPN != line.bom_item.sub_part.IPN %}
- {{ line.stock_item.part.IPN }} |
- {% else %}
- {{ line.stock_item.part.IPN }} |
- {% endif %}
- {{ line.stock_item.location.pathstring }} |
- {{ line.quantity }} |
-
- {% endfor %}
-
-
-```
-{% 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
- {% for loc in line.stock_item.location.path %}{{ loc.name }}{% if not forloop.last %}-{% endif %}{% endfor %} |
-```
-{% 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.
diff --git a/docs/report/purchase_order.md b/docs/report/purchase_order.md
index 91cfe10b..58c99a78 100644
--- a/docs/report/purchase_order.md
+++ b/docs/report/purchase_order.md
@@ -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.
diff --git a/docs/report/report.md b/docs/report/report.md
index 23c86a13..eee4ac51 100644
--- a/docs/report/report.md
+++ b/docs/report/report.md
@@ -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
diff --git a/docs/report/return_order.md b/docs/report/return_order.md
new file mode 100644
index 00000000..76dbf153
--- /dev/null
+++ b/docs/report/return_order.md
@@ -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.
diff --git a/docs/report/sales_order.md b/docs/report/sales_order.md
index 70c2e738..0c7aa662 100644
--- a/docs/report/sales_order.md
+++ b/docs/report/sales_order.md
@@ -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.
diff --git a/docs/report/test.md b/docs/report/test.md
index 89b9018b..a09f871c 100644
--- a/docs/report/test.md
+++ b/docs/report/test.md
@@ -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
{% 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.
diff --git a/docs/sell/return.md b/docs/sell/return.md
new file mode 100644
index 00000000..be577baa
--- /dev/null
+++ b/docs/sell/return.md
@@ -0,0 +1,101 @@
+---
+title: Return Order
+---
+
+## Return Orders
+
+Return Orders allow stock items (which have been sold or allocted to a customer) to be to be returned into stock, typically for the purpose of repair or refund.
+
+!!! tip "An Order By Any Other Name"
+ A Return Order may also be known as an [RMA](https://en.wikipedia.org/wiki/Return_merchandise_authorization)
+
+### Enable Return Order Functionality
+
+By default, Return Order functionality is not enabled - it must be enabled by a *staff* user from the settings page:
+
+{% with id="enable-return-order", url="sell/return_order_enable.png", description="Enable Return Orders" %}
+{% include "img.html" %}
+{% endwith %}
+
+Once this setting is enabled, you can access the "Return Orders" page from the main navigation bar:
+
+{% with id="return-order-navbar", url="sell/return_order_navbar.png", description="Access Return Orders" %}
+{% include "img.html" %}
+{% endwith %}
+
+### Return Order Permissions
+
+[Permissions](../settings/permissions.md) for Return Orders are managed via the `return_order` permission group. Users are assigned appropriate permissions based on the groups they are part of.
+
+### View Return Orders
+
+A list of Return Orders is displayed on the *Return Order* index page:
+
+{% with id="return-order-index", url="sell/return_order_index.png", description="Return Order Index" %}
+{% include "img.html" %}
+{% endwith %}
+
+Various filters are available to configure which orders are displayed, and how they are arranged.
+
+### Return Order Status Codes
+
+Each Return Order has a specific status code, as follows:
+
+| Status | Description |
+| --- | --- |
+| Pending | The return order has been created, but not sent to the customer |
+| In Progress | The return order has been sent to the customer |
+| Complete | The return order was marked as complete |
+| Cancelled | The return order was cancelled |
+
+## Create a Return Order
+
+From the Return Order index, click on New Return Order which opens the "Create Return Order" form.
+
+A Return Order is linked to a specific customer, which can be selected from the list of existing customers
+
+!!! warning "Customers Only"
+ Only companies with the "Customer" attribute enabled will be shown and can be selected
+
+{% with id="return-order-create", url="sell/return_order_create.png", description="Return Order Create" %}
+{% include "img.html" %}
+{% endwith %}
+
+Fill in the rest of the form with the return order information, and then click on Submit to create the order.
+
+### Return Order Reference
+
+Each Return Order is uniquely identified by its *Reference* field. Read more about [reference fields](../settings/reference.md).
+
+### Responsible Owner
+
+The order can be assigned to a responsible *owner*, which is either a user or group.
+
+## Return Order Detail
+
+Indvidual Return Orders can be viewed via the Return Order detail page:
+
+{% with id="return-order-detail", url="sell/return_order_detail.png", description="Return Order Detail" %}
+{% include "img.html" %}
+{% endwith %}
+
+Here the details of the return order are available, and specific actions can be performed:
+
+### Edit Return Order
+
+The Return Order can be edit by selecting the icon under the actions menu.
+
+### Line Items
+
+Return Order line items can be added while the [status](#return-order-status-codes) of the order is *In Progress*. Any stock item which is currently sold or assigned to the particular customer can be selected for return.
+
+!!! info "Serialized Stock Only"
+ Only stock items which are serialized can be selected for return from the customer
+
+### Extra Line Items
+
+While [line items](#line-items) must reference a particular stock item, extra line items are available for any other itemized information that needs to be conveyed with the order.
+
+## Return Order Reports
+
+Custom [reports](../report/return_order.md) can be generated against each Return Order.
diff --git a/docs/sell/so.md b/docs/sell/so.md
index ec1c8bbc..8c0321f0 100644
--- a/docs/sell/so.md
+++ b/docs/sell/so.md
@@ -1,10 +1,10 @@
---
-title: Sales Order
+title: Sales Orders
---
## Sales Orders
-Sales orders allow to track which stock items are sold to customers, therefore converting stock items / inventory into externally sold items.
+Sales orders allow tracking of which stock items are sold to customers, therefore converting stock items / inventory into externally sold items.
To access the sales order page, click on the Sell navigation tab and click on Sales Orders option in the dropdown list.
@@ -16,16 +16,16 @@ To access the sales order page, click on the New Sales Order which opens the "Create Sales Order" form.
-A sales order is linked to a specific customer, select one in the list of existing customers.
+A Sales Order is linked to a specific customer, select one in the list of existing customers.
-!!! warning
+!!! warning "Customers Only"
Only companies with the "Customer" attribute enabled will be shown and can be selected
-Fill out the rest of the form with the sales order information then click on Submit
+Fill out the rest of the form with the sales order information then click on Submit to create the order.
#### Add Line Items
diff --git a/docs/settings/permissions.md b/docs/settings/permissions.md
index 714577e5..ee9dde7d 100644
--- a/docs/settings/permissions.md
+++ b/docs/settings/permissions.md
@@ -31,8 +31,9 @@ InvenTree functionality is split into a number of distinct roles. A group will h
- **Stock Location** - The *stock location* role is related to accessing Stock Location data
- **Stock Item** - The *stock item* role is related to accessing Stock Item data
- **Build** - The *build* role is related to accessing Build Order and Bill of Materials data
-- **Purchase** - The *purchase* role is related to accessing Purchase Order data
-- **Sales** - The *sales* role is related to accessing Sales Order data
+- **Purchase Order** - The *purchase* role is related to accessing Purchase Order data
+- **Sales Order** - The *sales* role is related to accessing Sales Order data
+- **Return Order** - The *return* role is related to accessing Return Order data
{% with id="Roles Admin View", url="admin/roles.png", description="Roles" %}
{% include 'img.html' %}
diff --git a/docs/settings/reference.md b/docs/settings/reference.md
index 540645b1..9e94d956 100644
--- a/docs/settings/reference.md
+++ b/docs/settings/reference.md
@@ -15,6 +15,7 @@ Out of the box, InvenTree defines a standard "pattern" for each type of referenc
| Purchase Order | `{% raw %}PO-{ref:04d}{% endraw %}` | PO-0001 |
| Sales Order | `{% raw %}SO-{ref:04d}{% endraw %}` | SO-0123 |
| Build Order | `{% raw %}BO-{ref:04d}{% endraw %}` | BO-1234 |
+| Return Order | `{% raw %} RMA-{ref:04d}{% endraw %}` | RMA-0987 |
### Pattern Requirements
diff --git a/mkdocs.yml b/mkdocs.yml
index 03594c2c..56cc6326 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -108,14 +108,15 @@ nav:
- Customers: sell/customer.md
- Sales Orders: sell/so.md
- Shipments: sell/shipment.md
+ - Return Orders: sell/return.md
- Report:
- Templates: report/report.md
- Reports:
- Test Reports: report/test.md
- - Packing List: report/pack.md
- Build Order: report/build.md
- Purchase Order: report/purchase_order.md
- Sales Order: report/sales_order.md
+ - Return Order: report/return_order.md
- BOM: report/bom.md
- Labels: report/labels.md
- Helper Functions: report/helpers.md