diff --git a/CHANGELOG.md b/CHANGELOG.md index e66d62f..ac8d2e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ ## Version 2 +### Version 2.2.5 + +* [178](https://github.com/mlebreuil/netbox-contract/issues/178) Add the possibility to filter on invoice number, and contract name through the API. + ### Version 2.2.4 * [166](https://github.com/mlebreuil/netbox-contract/issues/166) Review the Contract view to include invoice template details and lines. diff --git a/pyproject.toml b/pyproject.toml index 70b1fba..107a6b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "netbox-contract" -version = "2.2.4" +version = "2.2.5" authors = [ { name="Marc Lebreuil", email="marc@famillelebreuil.net" }, ] diff --git a/src/netbox_contract/__init__.py b/src/netbox_contract/__init__.py index c26a161..d98e980 100644 --- a/src/netbox_contract/__init__.py +++ b/src/netbox_contract/__init__.py @@ -5,7 +5,7 @@ class ContractsConfig(PluginConfig): name = 'netbox_contract' verbose_name = 'Netbox contract' description = 'Contract management plugin for Netbox' - version = '2.2.4' + version = '2.2.5' author = 'Marc Lebreuil' author_email = 'marc@famillelebreuil.net' base_url = 'contracts' diff --git a/src/netbox_contract/filtersets.py b/src/netbox_contract/filtersets.py index df0481d..daf3426 100644 --- a/src/netbox_contract/filtersets.py +++ b/src/netbox_contract/filtersets.py @@ -1,3 +1,4 @@ +import django_filters from django.db.models import Q from netbox.filtersets import NetBoxModelFilterSet @@ -8,13 +9,16 @@ Invoice, InvoiceLine, ServiceProvider, + StatusChoices, ) class ContractFilterSet(NetBoxModelFilterSet): + status = django_filters.MultipleChoiceFilter(choices=StatusChoices, null_value=None) + class Meta: model = Contract - fields = ('id', 'internal_partie', 'status', 'parent') + fields = ('id', 'name', 'internal_partie', 'external_reference', 'parent') def search(self, queryset, name, value): return queryset.filter( @@ -28,7 +32,7 @@ def search(self, queryset, name, value): class InvoiceFilterSet(NetBoxModelFilterSet): class Meta: model = Invoice - fields = ('id', 'contracts') + fields = ('id', 'number', 'template', 'contracts') def search(self, queryset, name, value): return queryset.filter(