mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Corrected example in report mixin (#5801)
* Corrected report mixin example * Remove unused file
This commit is contained in:
parent
c47fa01965
commit
70578500ca
@ -41,7 +41,8 @@ class SampleReportPlugin(ReportMixin, InvenTreePlugin):
|
|||||||
"""Some custom function which is not required for the plugin to function"""
|
"""Some custom function which is not required for the plugin to function"""
|
||||||
return random.randint(0, 100)
|
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"""
|
"""Add example content to the report instance"""
|
||||||
|
|
||||||
# We can add any extra context data we want to the report
|
# 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()
|
context['random_int'] = self.some_custom_function()
|
||||||
|
|
||||||
# We can also add extra data to the context which is specific to the report type
|
# 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
|
# We can also use the 'request' object to add extra context data
|
||||||
context['request_method'] = request.method
|
context['request_method'] = request.method
|
||||||
|
Loading…
Reference in New Issue
Block a user