mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 11:36:44 +00:00
Catch TemplateDoesNotExist error (#4518)
This commit is contained in:
parent
73aa56c6f3
commit
4e72ac303f
@ -295,8 +295,11 @@ class StockItemTestReportPrint(StockItemTestReportMixin, ReportPrintMixin, Retri
|
|||||||
if common.models.InvenTreeSetting.get_setting('REPORT_ATTACH_TEST_REPORT', cache=False):
|
if common.models.InvenTreeSetting.get_setting('REPORT_ATTACH_TEST_REPORT', cache=False):
|
||||||
|
|
||||||
# Construct a PDF file object
|
# Construct a PDF file object
|
||||||
|
try:
|
||||||
pdf = report.get_document().write_pdf()
|
pdf = report.get_document().write_pdf()
|
||||||
pdf_content = ContentFile(pdf, "test_report.pdf")
|
pdf_content = ContentFile(pdf, "test_report.pdf")
|
||||||
|
except TemplateDoesNotExist:
|
||||||
|
return
|
||||||
|
|
||||||
StockItemAttachment.objects.create(
|
StockItemAttachment.objects.create(
|
||||||
attachment=pdf_content,
|
attachment=pdf_content,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user