Detail and print view for the BOM report

This commit is contained in:
Oliver Walters 2021-02-12 21:15:03 +11:00
parent 9be2989971
commit 4e9b9ee6fd
2 changed files with 13 additions and 2 deletions

View File

@ -369,7 +369,15 @@ class BOMReportPrint(generics.RetrieveUpdateDestroyAPIView, PartReportMixin, Rep
report_api_urls = [ report_api_urls = [
# Bill of Material reports
url(r'bom/', include([ url(r'bom/', include([
# Detail views
url(r'^(?P<pk>\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 # List view
url(r'^.*$', BOMReportList.as_view(), name='api-bom-report-list'), url(r'^.*$', BOMReportList.as_view(), name='api-bom-report-list'),
])), ])),

View File

@ -336,9 +336,12 @@ class BillOfMaterialsReport(ReportTemplateBase):
) )
def get_context_data(self, request): def get_context_data(self, request):
part = self.object_to_print
return { return {
'part': self.object_to_print, 'part': part,
'category': self.category, 'category': part.category,
} }