netbox-contract 2.3.2__tar.gz → 2.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {netbox_contract-2.3.2/netbox_contract.egg-info → netbox_contract-2.4.0}/PKG-INFO +15 -2
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/README.md +2 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/__init__.py +2 -2
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/api/serializers.py +20 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/api/urls.py +1 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/api/views.py +6 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/filtersets.py +17 -3
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/forms.py +68 -4
- netbox_contract-2.4.0/netbox_contract/locale/en/LC_MESSAGES/django.mo +0 -0
- netbox_contract-2.4.0/netbox_contract/locale/en/LC_MESSAGES/django.po +499 -0
- netbox_contract-2.4.0/netbox_contract/locale/fr/LC_MESSAGES/django.mo +0 -0
- netbox_contract-2.4.0/netbox_contract/locale/fr/LC_MESSAGES/django.po +503 -0
- netbox_contract-2.4.0/netbox_contract/migrations/0041_contracttype_contract_contract_type.py +48 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/models.py +32 -2
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/navigation.py +17 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/search.py +10 -1
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/tables.py +24 -2
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/template_content.py +4 -4
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/templates/netbox_contract/contract.html +6 -0
- netbox_contract-2.4.0/netbox_contract/templates/netbox_contract/contracttype.html +33 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/urls.py +51 -5
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/views.py +52 -4
- {netbox_contract-2.3.2 → netbox_contract-2.4.0/netbox_contract.egg-info}/PKG-INFO +15 -2
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract.egg-info/SOURCES.txt +7 -4
- netbox_contract-2.4.0/netbox_contract.egg-info/requires.txt +14 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/pyproject.toml +17 -1
- netbox_contract-2.3.2/netbox_contract/tests/__init__.py +0 -1
- netbox_contract-2.3.2/netbox_contract/tests/custom.py +0 -18
- netbox_contract-2.3.2/netbox_contract/tests/test_views.py +0 -449
- netbox_contract-2.3.2/netbox_contract.egg-info/requires.txt +0 -2
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/CONTRIBUTING.md +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/LICENSE +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/MANIFEST.in +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/docs/img/accounting_dimensions.png +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/docs/img/contract.png +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/docs/img/contract_linked_objects.png +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/docs/img/invoice.png +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/docs/img/invoice_line.png +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/docs/img/invoice_linked_objects.png +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/api/__init__.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/constants.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0001_initial.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0002_alter_contract_circuit_and_more.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0003_alter_contract_custom_field_data_and_more.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0004_contract_currency_invoice_currency.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0005_contract_accounting_dimensions_and_more.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0006_alter_contract_circuit.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0007_invoice_date.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0008_invoice_comments.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0009_contract_external_reference.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0010_invoice_contracts.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0011_auto_20230122_2112.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0012_remove_invoice_contract.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0013_contract_documents_invoice_documents.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0014_contract_end_date.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0015_contractassignement.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0016_contract_parent.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0017_alter_contract_accounting_dimensions.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0018_contract_external_partie_object_id_and_more.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0019_auto_20230924_1813.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0020_alter_contract_external_partie.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0021_alter_contract_external_partie.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0022_alter_contract_internal_partie_alter_contract_parent.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0023_rename_contractassignement_contractassignment_and_more.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0024_remove_contract_external_partie.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0025_remove_contract_circuit_and_more.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0026_auto_20240421_1550.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0027_invoiceline.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0028_invoiceline_accounting_dimensions.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0029_remove_invoiceline_accounting_dimensions_and_more.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0030_alter_invoiceline_accounting_dimensions.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0031_contract_invoice_template_invoice_template.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0032_alter_invoice_period_end_alter_invoice_period_start_and_more.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0033_remove_contract_invoice_template.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0034_contract_yrc_alter_contract_mrc.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0035_accountingdimension_status_and_more.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0036_alter_invoiceline_accounting_dimensions.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0037_contract_notice_period_alter_contract_currency_and_more.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0038_alter_accountingdimension_options_and_more.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0039_alter_accountingdimension_status_and_more.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/0040_alter_contract_currency_alter_invoice_currency_and_more.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/migrations/__init__.py +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/templates/contract_assignments_bottom.html +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/templates/contract_list_bottom.html +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/templates/netbox_contract/accountingdimension.html +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/templates/netbox_contract/contractassignment.html +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/templates/netbox_contract/invoice.html +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/templates/netbox_contract/invoiceline.html +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract/templates/netbox_contract/serviceprovider.html +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract.egg-info/dependency_links.txt +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/netbox_contract.egg-info/top_level.txt +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/setup.cfg +0 -0
- {netbox_contract-2.3.2 → netbox_contract-2.4.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: netbox-contract
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: Contract management plugin for Netbox
|
|
5
5
|
Author-email: Marc Lebreuil <marc@famillelebreuil.net>
|
|
6
6
|
Project-URL: Homepage, https://github.com/mlebreuil/netbox-contract
|
|
@@ -13,6 +13,17 @@ Description-Content-Type: text/markdown
|
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: python-dateutil
|
|
15
15
|
Requires-Dist: drf_yasg
|
|
16
|
+
Requires-Dist: Django
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: check-manifest; extra == "dev"
|
|
19
|
+
Requires-Dist: mkdocs; extra == "dev"
|
|
20
|
+
Requires-Dist: mkdocs-material; extra == "dev"
|
|
21
|
+
Requires-Dist: ruff; extra == "dev"
|
|
22
|
+
Provides-Extra: test
|
|
23
|
+
Requires-Dist: coverage; extra == "test"
|
|
24
|
+
Requires-Dist: pytest; extra == "test"
|
|
25
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
26
|
+
Dynamic: license-file
|
|
16
27
|
|
|
17
28
|
# Contract plugin
|
|
18
29
|
|
|
@@ -36,6 +47,7 @@ Accounting dimensions can be linked with invoice lines.
|
|
|
36
47
|
|----------------|----------------|
|
|
37
48
|
| 4.1 | 2.2 |
|
|
38
49
|
| 4.2 | 2.3 |
|
|
50
|
+
| 4.3 | 2.4 |
|
|
39
51
|
|
|
40
52
|
## Installing
|
|
41
53
|
|
|
@@ -96,6 +108,7 @@ The first currency will also be the default currency for contracts.
|
|
|
96
108
|
# configuration.py
|
|
97
109
|
FIELD_CHOICES = {
|
|
98
110
|
'netbox_contract.Contract.internal_partie': (
|
|
111
|
+
('default', 'Default entity', 'green'),
|
|
99
112
|
('entity1', 'Entity 1', 'green'),
|
|
100
113
|
('entity2', 'Entity 2', 'yellow'),
|
|
101
114
|
),
|
|
@@ -20,6 +20,7 @@ Accounting dimensions can be linked with invoice lines.
|
|
|
20
20
|
|----------------|----------------|
|
|
21
21
|
| 4.1 | 2.2 |
|
|
22
22
|
| 4.2 | 2.3 |
|
|
23
|
+
| 4.3 | 2.4 |
|
|
23
24
|
|
|
24
25
|
## Installing
|
|
25
26
|
|
|
@@ -80,6 +81,7 @@ The first currency will also be the default currency for contracts.
|
|
|
80
81
|
# configuration.py
|
|
81
82
|
FIELD_CHOICES = {
|
|
82
83
|
'netbox_contract.Contract.internal_partie': (
|
|
84
|
+
('default', 'Default entity', 'green'),
|
|
83
85
|
('entity1', 'Entity 1', 'green'),
|
|
84
86
|
('entity2', 'Entity 2', 'yellow'),
|
|
85
87
|
),
|
|
@@ -5,11 +5,11 @@ class ContractsConfig(PluginConfig):
|
|
|
5
5
|
name = 'netbox_contract'
|
|
6
6
|
verbose_name = 'Netbox contract'
|
|
7
7
|
description = 'Contract management plugin for Netbox'
|
|
8
|
-
version = '2.
|
|
8
|
+
version = '2.4.0'
|
|
9
9
|
author = 'Marc Lebreuil'
|
|
10
10
|
author_email = 'marc@famillelebreuil.net'
|
|
11
11
|
base_url = 'contracts'
|
|
12
|
-
min_version = '4.
|
|
12
|
+
min_version = '4.3.0'
|
|
13
13
|
required_settings = []
|
|
14
14
|
default_settings = {
|
|
15
15
|
'top_level_menu': False,
|
|
@@ -11,6 +11,7 @@ from ..models import (
|
|
|
11
11
|
AccountingDimension,
|
|
12
12
|
Contract,
|
|
13
13
|
ContractAssignment,
|
|
14
|
+
ContractType,
|
|
14
15
|
Invoice,
|
|
15
16
|
InvoiceLine,
|
|
16
17
|
ServiceProvider,
|
|
@@ -395,3 +396,22 @@ class AccountingDimensionSerializer(NetBoxModelSerializer):
|
|
|
395
396
|
'last_updated',
|
|
396
397
|
)
|
|
397
398
|
brief_fields = ('id', 'name', 'value', 'url', 'display')
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
class ContractTypeSerializer(NetBoxModelSerializer):
|
|
402
|
+
url = serializers.HyperlinkedIdentityField(view_name='plugins-api:netbox_contract-api:contracttype-detail')
|
|
403
|
+
|
|
404
|
+
class Meta:
|
|
405
|
+
model = ContractType
|
|
406
|
+
fields = (
|
|
407
|
+
'id',
|
|
408
|
+
'url',
|
|
409
|
+
'display',
|
|
410
|
+
'name',
|
|
411
|
+
'description',
|
|
412
|
+
'tags',
|
|
413
|
+
'custom_fields',
|
|
414
|
+
'created',
|
|
415
|
+
'last_updated',
|
|
416
|
+
)
|
|
417
|
+
brief_fields = ('id', 'name', 'description', 'url', 'display')
|
|
@@ -6,6 +6,7 @@ app_name = 'netbox_contract'
|
|
|
6
6
|
|
|
7
7
|
router = NetBoxRouter()
|
|
8
8
|
router.register('contracts', views.ContractViewSet)
|
|
9
|
+
router.register('contracttype', views.ContractTypeViewSet)
|
|
9
10
|
router.register('invoices', views.InvoiceViewSet)
|
|
10
11
|
router.register('serviceproviders', views.ServiceProviderViewSet)
|
|
11
12
|
router.register('contractassignment', views.ContractAssignmentViewSet)
|
|
@@ -7,6 +7,7 @@ from .serializers import (
|
|
|
7
7
|
AccountingDimensionSerializer,
|
|
8
8
|
ContractAssignmentSerializer,
|
|
9
9
|
ContractSerializer,
|
|
10
|
+
ContractTypeSerializer,
|
|
10
11
|
InvoiceLineSerializer,
|
|
11
12
|
InvoiceSerializer,
|
|
12
13
|
ServiceProviderSerializer,
|
|
@@ -51,3 +52,8 @@ class InvoiceLineViewSet(NetBoxModelViewSet):
|
|
|
51
52
|
class AccountingDimensionViewSet(NetBoxModelViewSet):
|
|
52
53
|
queryset = models.AccountingDimension.objects.prefetch_related('tags')
|
|
53
54
|
serializer_class = AccountingDimensionSerializer
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class ContractTypeViewSet(NetBoxModelViewSet):
|
|
58
|
+
queryset = models.ContractType.objects.prefetch_related('tags')
|
|
59
|
+
serializer_class = ContractTypeSerializer
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import django_filters
|
|
2
2
|
from django.db.models import Q
|
|
3
3
|
from netbox.filtersets import NetBoxModelFilterSet
|
|
4
|
-
from tenancy.filtersets import TenancyFilterSet
|
|
4
|
+
from tenancy.filtersets import ContactModelFilterSet, TenancyFilterSet
|
|
5
5
|
|
|
6
6
|
from .models import (
|
|
7
7
|
AccountingDimension,
|
|
8
8
|
AccountingDimensionStatusChoices,
|
|
9
9
|
Contract,
|
|
10
10
|
ContractAssignment,
|
|
11
|
+
ContractType,
|
|
11
12
|
CurrencyChoices,
|
|
12
13
|
InternalEntityChoices,
|
|
13
14
|
Invoice,
|
|
@@ -17,7 +18,7 @@ from .models import (
|
|
|
17
18
|
)
|
|
18
19
|
|
|
19
20
|
|
|
20
|
-
class ContractFilterSet(NetBoxModelFilterSet, TenancyFilterSet):
|
|
21
|
+
class ContractFilterSet(ContactModelFilterSet, NetBoxModelFilterSet, TenancyFilterSet):
|
|
21
22
|
status = django_filters.MultipleChoiceFilter(choices=StatusChoices, null_value=None)
|
|
22
23
|
internal_partie = django_filters.MultipleChoiceFilter(
|
|
23
24
|
choices=InternalEntityChoices, null_value=None
|
|
@@ -25,12 +26,16 @@ class ContractFilterSet(NetBoxModelFilterSet, TenancyFilterSet):
|
|
|
25
26
|
currency = django_filters.MultipleChoiceFilter(
|
|
26
27
|
choices=CurrencyChoices, null_value=None
|
|
27
28
|
)
|
|
29
|
+
contract_type = django_filters.ModelMultipleChoiceFilter(
|
|
30
|
+
field_name='contract_type__name', to_field_name='name', queryset=ContractType.objects.all()
|
|
31
|
+
)
|
|
28
32
|
|
|
29
33
|
class Meta:
|
|
30
34
|
model = Contract
|
|
31
35
|
fields = (
|
|
32
36
|
'id',
|
|
33
37
|
'name',
|
|
38
|
+
'contract_type',
|
|
34
39
|
'external_reference',
|
|
35
40
|
'start_date',
|
|
36
41
|
'end_date',
|
|
@@ -71,7 +76,7 @@ class InvoiceFilterSet(NetBoxModelFilterSet):
|
|
|
71
76
|
)
|
|
72
77
|
|
|
73
78
|
|
|
74
|
-
class ServiceProviderFilterSet(NetBoxModelFilterSet):
|
|
79
|
+
class ServiceProviderFilterSet(ContactModelFilterSet, NetBoxModelFilterSet):
|
|
75
80
|
class Meta:
|
|
76
81
|
model = ServiceProvider
|
|
77
82
|
fields = ('id', 'name')
|
|
@@ -80,6 +85,15 @@ class ServiceProviderFilterSet(NetBoxModelFilterSet):
|
|
|
80
85
|
return queryset.filter(name__icontains=value)
|
|
81
86
|
|
|
82
87
|
|
|
88
|
+
class ContractTypeFilterSet(NetBoxModelFilterSet):
|
|
89
|
+
class Meta:
|
|
90
|
+
model = ContractType
|
|
91
|
+
fields = ('name', 'description', 'color')
|
|
92
|
+
|
|
93
|
+
def search(self, queryset, name, value):
|
|
94
|
+
return queryset.filter(name__icontains=value)
|
|
95
|
+
|
|
96
|
+
|
|
83
97
|
class ContractAssignmentFilterSet(NetBoxModelFilterSet):
|
|
84
98
|
class Meta:
|
|
85
99
|
model = ContractAssignment
|
|
@@ -9,10 +9,11 @@ from netbox.forms import (
|
|
|
9
9
|
NetBoxModelForm,
|
|
10
10
|
NetBoxModelImportForm,
|
|
11
11
|
)
|
|
12
|
+
from tenancy.forms import ContactModelFilterForm, TenancyFilterForm
|
|
12
13
|
from tenancy.models import Tenant
|
|
13
|
-
from tenancy.forms import TenancyFilterForm
|
|
14
14
|
from utilities.forms import BOOLEAN_WITH_BLANK_CHOICES
|
|
15
15
|
from utilities.forms.fields import (
|
|
16
|
+
ColorField,
|
|
16
17
|
CommentField,
|
|
17
18
|
ContentTypeChoiceField,
|
|
18
19
|
CSVChoiceField,
|
|
@@ -26,12 +27,13 @@ from utilities.forms.fields import (
|
|
|
26
27
|
)
|
|
27
28
|
from utilities.forms.widgets import DatePicker, HTMXSelect
|
|
28
29
|
|
|
29
|
-
from .constants import
|
|
30
|
+
from .constants import ASSIGNEMENT_MODELS, SERVICE_PROVIDER_MODELS
|
|
30
31
|
from .models import (
|
|
31
32
|
AccountingDimension,
|
|
32
33
|
AccountingDimensionStatusChoices,
|
|
33
34
|
Contract,
|
|
34
35
|
ContractAssignment,
|
|
36
|
+
ContractType,
|
|
35
37
|
CurrencyChoices,
|
|
36
38
|
InternalEntityChoices,
|
|
37
39
|
Invoice,
|
|
@@ -63,6 +65,9 @@ class ContractForm(NetBoxModelForm):
|
|
|
63
65
|
selector=True,
|
|
64
66
|
label=_('Parent'),
|
|
65
67
|
)
|
|
68
|
+
contract_type = DynamicModelChoiceField(
|
|
69
|
+
queryset=ContractType.objects.all(), required=False, selector=True, label=_('Contract type')
|
|
70
|
+
)
|
|
66
71
|
|
|
67
72
|
def __init__(self, *args, **kwargs):
|
|
68
73
|
initial = kwargs.get('initial', None)
|
|
@@ -101,6 +106,7 @@ class ContractForm(NetBoxModelForm):
|
|
|
101
106
|
model = Contract
|
|
102
107
|
fields = (
|
|
103
108
|
'name',
|
|
109
|
+
'contract_type',
|
|
104
110
|
'external_partie_object_type',
|
|
105
111
|
'external_partie_object',
|
|
106
112
|
'external_reference',
|
|
@@ -135,9 +141,15 @@ class ContractForm(NetBoxModelForm):
|
|
|
135
141
|
raise ValidationError('you should set monthly OR yearly recuring costs not both')
|
|
136
142
|
|
|
137
143
|
|
|
138
|
-
class ContractFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|
144
|
+
class ContractFilterForm(ContactModelFilterForm, TenancyFilterForm, NetBoxModelFilterSetForm):
|
|
139
145
|
model = Contract
|
|
140
146
|
|
|
147
|
+
contract_type = DynamicModelChoiceField(
|
|
148
|
+
queryset=ContractType.objects.all(),
|
|
149
|
+
required=False,
|
|
150
|
+
selector=True,
|
|
151
|
+
label=_('Contract type'),
|
|
152
|
+
)
|
|
141
153
|
external_reference = forms.CharField(required=False, label=_('External reference'))
|
|
142
154
|
internal_partie = forms.ChoiceField(choices=InternalEntityChoices, required=False, label=_('Internal partie'))
|
|
143
155
|
status = forms.ChoiceField(choices=StatusChoices, required=False, label=_('Status'))
|
|
@@ -175,11 +187,19 @@ class ContractCSVForm(NetBoxModelImportForm):
|
|
|
175
187
|
required=False,
|
|
176
188
|
label=_('Parent'),
|
|
177
189
|
)
|
|
190
|
+
contract_type = CSVModelChoiceField(
|
|
191
|
+
queryset=ContractType.objects.all(),
|
|
192
|
+
to_field_name='name',
|
|
193
|
+
help_text='Contract type name',
|
|
194
|
+
required=False,
|
|
195
|
+
label=_('Contract type'),
|
|
196
|
+
)
|
|
178
197
|
|
|
179
198
|
class Meta:
|
|
180
199
|
model = Contract
|
|
181
200
|
fields = [
|
|
182
201
|
'name',
|
|
202
|
+
'contract_type',
|
|
183
203
|
'external_partie_object_type',
|
|
184
204
|
'external_partie_object_id',
|
|
185
205
|
'external_reference',
|
|
@@ -210,6 +230,12 @@ class ContractCSVForm(NetBoxModelImportForm):
|
|
|
210
230
|
|
|
211
231
|
class ContractBulkEditForm(NetBoxModelBulkEditForm):
|
|
212
232
|
name = forms.CharField(max_length=100, required=False, label=_('Name'))
|
|
233
|
+
contract_type = DynamicModelChoiceField(
|
|
234
|
+
queryset=ContractType.objects.all(),
|
|
235
|
+
required=False,
|
|
236
|
+
selector=True,
|
|
237
|
+
label=_('Contract Type')
|
|
238
|
+
)
|
|
213
239
|
external_reference = forms.CharField(max_length=100, required=False, label=_('External reference'))
|
|
214
240
|
internal_partie = forms.ChoiceField(choices=InternalEntityChoices, required=False, label=_('Internal partie'))
|
|
215
241
|
tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False, selector=True, label=_('Tenant'))
|
|
@@ -225,6 +251,44 @@ class ContractBulkEditForm(NetBoxModelBulkEditForm):
|
|
|
225
251
|
model = Contract
|
|
226
252
|
|
|
227
253
|
|
|
254
|
+
# ContractType
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
class ContractTypeForm(NetBoxModelForm):
|
|
258
|
+
color = ColorField(label=_('Color'))
|
|
259
|
+
|
|
260
|
+
class Meta:
|
|
261
|
+
model = ContractType
|
|
262
|
+
fields = (
|
|
263
|
+
'name',
|
|
264
|
+
'description',
|
|
265
|
+
'color',
|
|
266
|
+
'tags',
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
class ContractTypeCSVForm(NetBoxModelImportForm):
|
|
271
|
+
name = forms.CharField(max_length=100, label=_('Name'))
|
|
272
|
+
description = CommentField(label=_('Description'))
|
|
273
|
+
color = ColorField(label=_('Color'))
|
|
274
|
+
|
|
275
|
+
class Meta:
|
|
276
|
+
model = ContractType
|
|
277
|
+
fields = ['name', 'description', 'color']
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
class ContractTypeBulkEditForm(NetBoxModelBulkEditForm):
|
|
281
|
+
description = CommentField(label=_('Description'))
|
|
282
|
+
nullable_fields = ('comments',)
|
|
283
|
+
color = ColorField(label=_('Color'), required=False,)
|
|
284
|
+
model = ContractType
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
class ContractTypeFilterForm(NetBoxModelFilterSetForm):
|
|
288
|
+
model = ContractType
|
|
289
|
+
name = forms.CharField(required=False, label=_('Name'))
|
|
290
|
+
description = CommentField(label=_('Description'))
|
|
291
|
+
|
|
228
292
|
# Invoice
|
|
229
293
|
|
|
230
294
|
|
|
@@ -437,7 +501,7 @@ class ServiceProviderForm(NetBoxModelForm):
|
|
|
437
501
|
fields = ('name', 'slug', 'portal_url', 'comments', 'tags')
|
|
438
502
|
|
|
439
503
|
|
|
440
|
-
class ServiceProviderFilterForm(NetBoxModelFilterSetForm):
|
|
504
|
+
class ServiceProviderFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
|
441
505
|
model = ServiceProvider
|
|
442
506
|
name = forms.CharField(required=False, label=_('Name'))
|
|
443
507
|
tag = TagFilterField(model)
|
|
Binary file
|