From 70578500ca525f06ebf460cde68b470985af7ed2 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 27 Oct 2023 14:08:30 +0200 Subject: [PATCH] Corrected example in report mixin (#5801) * Corrected report mixin example * Remove unused file --- docs/docs/extend/plugins/report.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/docs/extend/plugins/report.md b/docs/docs/extend/plugins/report.md index e72814d8b1..1d0dc0c727 100644 --- a/docs/docs/extend/plugins/report.md +++ b/docs/docs/extend/plugins/report.md @@ -41,7 +41,8 @@ class SampleReportPlugin(ReportMixin, InvenTreePlugin): """Some custom function which is not required for the plugin to function""" return random.randint(0, 100) - def add_report_context(self, instance, request, context): + def add_report_context(self, report_instance, model_instance, request, context): + """Add example content to the report instance""" # We can add any extra context data we want to the report @@ -53,7 +54,7 @@ class SampleReportPlugin(ReportMixin, InvenTreePlugin): context['random_int'] = self.some_custom_function() # We can also add extra data to the context which is specific to the report type - context['is_purchase_order'] = isinstance(instance, PurchaseOrderReport) + context['is_purchase_order'] = isinstance(report_instance, PurchaseOrderReport) # We can also use the 'request' object to add extra context data context['request_method'] = request.method