diff --git a/InvenTree/part/templates/part/bom.html b/InvenTree/part/templates/part/bom.html
index 515cae37a0..d8e8854791 100644
--- a/InvenTree/part/templates/part/bom.html
+++ b/InvenTree/part/templates/part/bom.html
@@ -35,34 +35,37 @@
{% if part.variant_of %}
{% endif %}
{% elif part.active %}
{% if roles.part.change %}
{% if part.is_bom_valid == False %}
{% endif %}
{% endif %}
+ {% endif %}
+
- {% endif %}
@@ -215,4 +218,8 @@
{% endif %}
+ $("#print-bom-report").click(function() {
+ printBomReports([{{ part.pk }}]);
+ });
+
{% endblock %}
diff --git a/InvenTree/templates/js/report.js b/InvenTree/templates/js/report.js
index ce780f857c..e79d80dc41 100644
--- a/InvenTree/templates/js/report.js
+++ b/InvenTree/templates/js/report.js
@@ -102,7 +102,7 @@ function printTestReports(items, options={}) {
return;
}
- // Request available labels from the server
+ // Request available reports from the server
inventreeGet(
'{% url "api-stockitem-testreport-list" %}',
{
@@ -139,4 +139,58 @@ function printTestReports(items, options={}) {
}
}
);
-}
\ No newline at end of file
+}
+
+
+function printBomReports(parts, options={}) {
+ /**
+ * Print BOM reports for the provided part(s)
+ */
+
+ if (parts.length == 0) {
+ showAlertDialog(
+ '{% trans "Select Parts" %}',
+ '{% trans "Part(s) must be selected before printing reports" %}'
+ );
+
+ return;
+ }
+
+ // Request available reports from the server
+ inventreeGet(
+ '{% url "api-bom-report-list" %}',
+ {
+ enabled: true,
+ parts: parts,
+ },
+ {
+ success: function(response) {
+ if (response.length == 0) {
+ showAlertDialog(
+ '{% trans "No Reports Found" %}',
+ '{% trans "No report templates found which match selected part(s)" %}',
+ );
+
+ return;
+ }
+
+ // Select which report to print
+ selectReport(
+ response,
+ parts,
+ {
+ success: function(pk) {
+ var href = `/api/report/bom/${pk}/print/?`;
+
+ parts.forEach(function(part) {
+ href += `parts[]=${part}&`;
+ });
+
+ window.location.href = href;
+ }
+ }
+ );
+ }
+ }
+ )
+}