From 9a35293126336cb4c1906f65642e0e8b17e4c42b Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 23 Aug 2020 21:08:41 +1000 Subject: [PATCH] Remove PartFilterMixin class --- InvenTree/report/admin.py | 2 +- InvenTree/report/models.py | 34 +++------------------------------- 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/InvenTree/report/admin.py b/InvenTree/report/admin.py index 8efac4ac14..7d6403f5d9 100644 --- a/InvenTree/report/admin.py +++ b/InvenTree/report/admin.py @@ -8,7 +8,7 @@ from .models import TestReport, ReportAsset class ReportTemplateAdmin(admin.ModelAdmin): - list_display = ('name', 'description', 'template', 'enabled') + list_display = ('name', 'description', 'template', 'filters', 'enabled') class ReportAssetAdmin(admin.ModelAdmin): diff --git a/InvenTree/report/models.py b/InvenTree/report/models.py index 625ca5582a..66117f05ed 100644 --- a/InvenTree/report/models.py +++ b/InvenTree/report/models.py @@ -153,36 +153,6 @@ class ReportTemplateBase(models.Model): verbose_name=_('Enabled') ) - class Meta: - abstract = True - - -class PartFilterMixin(models.Model): - """ - A model mixin used for matching a report type against a Part object. - Used to assign a report to a given part using custom filters. - """ - - class Meta: - abstract = True - - def matches_part(self, part): - """ - Test if this report matches a given part. - """ - - filters = self.get_part_filters() - - parts = PartModels.Part.objects.filter(**filters) - - parts = parts.filter(pk=part.pk) - - return parts.exists() - - def get_part_filters(self): - """ Return a map of filters to be used for Part filtering """ - return validateFilterString(self.part_filters) - filters = models.CharField( blank=True, max_length=250, @@ -190,8 +160,10 @@ class PartFilterMixin(models.Model): validators=[validateFilterString] ) + class Meta: + abstract = True -class TestReport(ReportTemplateBase, PartFilterMixin): +class TestReport(ReportTemplateBase): """ Render a TestReport against a StockItem object. """