From a34a61edff5af5c66c619535cec19d4b61ab7e24 Mon Sep 17 00:00:00 2001
From: Oliver
Date: Mon, 19 Jul 2021 16:53:15 +1000
Subject: [PATCH 1/3] Add doc for new "installed_items" context
---
docs/report/test.md | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/docs/report/test.md b/docs/report/test.md
index a3e3370..6232925 100644
--- a/docs/report/test.md
+++ b/docs/report/test.md
@@ -35,6 +35,7 @@ In addition to the default report context variables, the following context varia
| 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 |
+| installed_items | A flattened list representing all `StockItem` objects which are *installed inside* the referenced `StockItem` object |
#### Results
@@ -53,3 +54,20 @@ Firmware Checksum: {% raw %}{{ results.firmwarechecksum.value }}.
Uploaded by {{ results.firmwarechecksum.user }}{% endraw %}
```
+
+#### Installed Items
+
+The *installed_items* context variable is a list of all `StockItem` instances which are installed inside the `StockItem` referenced by the report template. Each `StockItem` can be dereferenced as follows:
+
+```html
+{% raw %}
+
+ {% for sub_item in installed_items %}
+
+ {{ sub_item.full_name }} |
+ Serial Number: {{ sub_item.serial }} |
+ Pass: {{ sub_item.passedAllRequiredTests }} |
+ {% endfor %}
+
+{% endraw %}
+```
\ No newline at end of file
From 928222b09fc3bdba852191ecea080603f727731b Mon Sep 17 00:00:00 2001
From: Oliver
Date: Mon, 19 Jul 2021 16:54:01 +1000
Subject: [PATCH 2/3] Fix
---
docs/report/test.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/report/test.md b/docs/report/test.md
index 6232925..08d4610 100644
--- a/docs/report/test.md
+++ b/docs/report/test.md
@@ -67,6 +67,7 @@ The *installed_items* context variable is a list of all `StockItem` instances wh
{{ sub_item.full_name }} |
Serial Number: {{ sub_item.serial }} |
Pass: {{ sub_item.passedAllRequiredTests }} |
+
{% endfor %}
{% endraw %}
From bbfcffe14e6fe2c80ec9e49e337ecc05fee7f02a Mon Sep 17 00:00:00 2001
From: Oliver
Date: Mon, 19 Jul 2021 16:56:27 +1000
Subject: [PATCH 3/3] Add docs
---
docs/releases/0.4.0.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/docs/releases/0.4.0.md b/docs/releases/0.4.0.md
index b3f4238..7949a06 100644
--- a/docs/releases/0.4.0.md
+++ b/docs/releases/0.4.0.md
@@ -10,6 +10,10 @@ title: Release 0.4.0
[#1811](https://github.com/inventree/InvenTree/pull/1811) provides dynamic loading of detail views via the left-hand navigation menu. This significantly improves perceived speed by the user, as the entire page does not have to be reloaded.
+### Test Report
+
+[#1842](https://github.com/inventree/InvenTree/pull/1842) adds "installed items" to the available context data for a StockItem TestReport template.
+
## Major Bug Fixes
| Pull Request | Description |