From 4e9b9ee6fd68c30102bfc455329cb62340868eca Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Fri, 12 Feb 2021 21:15:03 +1100 Subject: [PATCH] Detail and print view for the BOM report --- InvenTree/report/api.py | 8 ++++++++ InvenTree/report/models.py | 7 +++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/InvenTree/report/api.py b/InvenTree/report/api.py index 2b8a3cccf1..9d3eea573c 100644 --- a/InvenTree/report/api.py +++ b/InvenTree/report/api.py @@ -369,7 +369,15 @@ class BOMReportPrint(generics.RetrieveUpdateDestroyAPIView, PartReportMixin, Rep report_api_urls = [ + # Bill of Material reports url(r'bom/', include([ + + # Detail views + url(r'^(?P\d+)/', include([ + url(r'print/?', BOMReportPrint.as_view(), name='api-bom-report-print'), + url(r'^.*$', BOMReportDetail.as_view(), name='api-bom-report-detail'), + ])), + # List view url(r'^.*$', BOMReportList.as_view(), name='api-bom-report-list'), ])), diff --git a/InvenTree/report/models.py b/InvenTree/report/models.py index 25b0c09da8..45fbe052fa 100644 --- a/InvenTree/report/models.py +++ b/InvenTree/report/models.py @@ -336,9 +336,12 @@ class BillOfMaterialsReport(ReportTemplateBase): ) def get_context_data(self, request): + + part = self.object_to_print + return { - 'part': self.object_to_print, - 'category': self.category, + 'part': part, + 'category': part.category, }