netbox-contract 2.2.1__tar.gz → 2.2.3__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.2.1/src/netbox_contract.egg-info → netbox_contract-2.2.3}/PKG-INFO +1 -1
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/pyproject.toml +1 -1
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/__init__.py +1 -1
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/api/serializers.py +26 -7
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/api/views.py +3 -1
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/filtersets.py +2 -4
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/forms.py +24 -7
- netbox_contract-2.2.3/src/netbox_contract/migrations/0035_accountingdimension_status_and_more.py +24 -0
- netbox_contract-2.2.3/src/netbox_contract/migrations/0036_alter_invoiceline_accounting_dimensions.py +19 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/models.py +25 -3
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/templates/netbox_contract/accountingdimension.html +4 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/urls.py +20 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/views.py +1 -1
- {netbox_contract-2.2.1 → netbox_contract-2.2.3/src/netbox_contract.egg-info}/PKG-INFO +1 -1
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract.egg-info/SOURCES.txt +2 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/LICENSE +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/MANIFEST.in +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/README.md +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/setup.cfg +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/setup.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/api/__init__.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/api/urls.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/constants.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0001_initial.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0002_alter_contract_circuit_and_more.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0003_alter_contract_custom_field_data_and_more.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0004_contract_currency_invoice_currency.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0005_contract_accounting_dimensions_and_more.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0006_alter_contract_circuit.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0007_invoice_date.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0008_invoice_comments.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0009_contract_external_reference.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0010_invoice_contracts.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0011_auto_20230122_2112.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0012_remove_invoice_contract.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0013_contract_documents_invoice_documents.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0014_contract_end_date.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0015_contractassignement.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0016_contract_parent.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0017_alter_contract_accounting_dimensions.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0018_contract_external_partie_object_id_and_more.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0019_auto_20230924_1813.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0020_alter_contract_external_partie.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0021_alter_contract_external_partie.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0022_alter_contract_internal_partie_alter_contract_parent.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0023_rename_contractassignement_contractassignment_and_more.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0024_remove_contract_external_partie.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0025_remove_contract_circuit_and_more.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0026_auto_20240421_1550.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0027_invoiceline.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0028_invoiceline_accounting_dimensions.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0029_remove_invoiceline_accounting_dimensions_and_more.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0030_alter_invoiceline_accounting_dimensions.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0031_contract_invoice_template_invoice_template.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0032_alter_invoice_period_end_alter_invoice_period_start_and_more.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0033_remove_contract_invoice_template.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0034_contract_yrc_alter_contract_mrc.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/__init__.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/navigation.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/search.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/tables.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/template_content.py +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/templates/contract_assignments_bottom.html +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/templates/contract_list_bottom.html +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/templates/netbox_contract/contract.html +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/templates/netbox_contract/contractassignment.html +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/templates/netbox_contract/invoice.html +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/templates/netbox_contract/invoiceline.html +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/templates/netbox_contract/serviceprovider.html +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract.egg-info/dependency_links.txt +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract.egg-info/not-zip-safe +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract.egg-info/requires.txt +0 -0
- {netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract.egg-info/top_level.txt +0 -0
|
@@ -5,7 +5,7 @@ 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.2.
|
|
8
|
+
version = '2.2.3'
|
|
9
9
|
author = 'Marc Lebreuil'
|
|
10
10
|
author_email = 'marc@famillelebreuil.net'
|
|
11
11
|
base_url = 'contracts'
|
|
@@ -50,7 +50,7 @@ class NestedInvoiceSerializer(WritableNestedSerializer):
|
|
|
50
50
|
|
|
51
51
|
class NestedContractAssignmentSerializer(WritableNestedSerializer):
|
|
52
52
|
url = serializers.HyperlinkedIdentityField(
|
|
53
|
-
view_name='plugins-api:netbox_contract-api:
|
|
53
|
+
view_name='plugins-api:netbox_contract-api:contractassignment-detail'
|
|
54
54
|
)
|
|
55
55
|
|
|
56
56
|
class Meta:
|
|
@@ -61,18 +61,25 @@ class NestedContractAssignmentSerializer(WritableNestedSerializer):
|
|
|
61
61
|
|
|
62
62
|
class NestedInvoicelineSerializer(WritableNestedSerializer):
|
|
63
63
|
url = serializers.HyperlinkedIdentityField(
|
|
64
|
-
view_name='plugins-api:netbox_contract-api:
|
|
64
|
+
view_name='plugins-api:netbox_contract-api:invoiceline-detail'
|
|
65
65
|
)
|
|
66
66
|
|
|
67
67
|
class Meta:
|
|
68
68
|
model = InvoiceLine
|
|
69
|
-
fields = ('id', 'url', 'display', 'invoice', 'amount')
|
|
70
|
-
brief_fields = (
|
|
69
|
+
fields = ('id', 'url', 'display', 'invoice', 'accounting_dimensions', 'amount')
|
|
70
|
+
brief_fields = (
|
|
71
|
+
'id',
|
|
72
|
+
'url',
|
|
73
|
+
'display',
|
|
74
|
+
'invoice',
|
|
75
|
+
'accounting_dimensions',
|
|
76
|
+
'amount',
|
|
77
|
+
)
|
|
71
78
|
|
|
72
79
|
|
|
73
80
|
class NestedAccountingDimensionSerializer(WritableNestedSerializer):
|
|
74
81
|
url = serializers.HyperlinkedIdentityField(
|
|
75
|
-
view_name='plugins-api:netbox_contract-api:
|
|
82
|
+
view_name='plugins-api:netbox_contract-api:accountingdimension-detail'
|
|
76
83
|
)
|
|
77
84
|
|
|
78
85
|
class Meta:
|
|
@@ -227,6 +234,10 @@ class InvoiceLineSerializer(NetBoxModelSerializer):
|
|
|
227
234
|
url = serializers.HyperlinkedIdentityField(
|
|
228
235
|
view_name='plugins-api:netbox_contract-api:invoiceline-detail'
|
|
229
236
|
)
|
|
237
|
+
invoice = NestedInvoiceSerializer(many=False, required=False)
|
|
238
|
+
accounting_dimensions = NestedAccountingDimensionSerializer(
|
|
239
|
+
many=True, required=False
|
|
240
|
+
)
|
|
230
241
|
|
|
231
242
|
class Meta:
|
|
232
243
|
model = InvoiceLine
|
|
@@ -237,13 +248,21 @@ class InvoiceLineSerializer(NetBoxModelSerializer):
|
|
|
237
248
|
'invoice',
|
|
238
249
|
'amount',
|
|
239
250
|
'currency',
|
|
251
|
+
'accounting_dimensions',
|
|
240
252
|
'comments',
|
|
241
253
|
'tags',
|
|
242
254
|
'custom_fields',
|
|
243
255
|
'created',
|
|
244
256
|
'last_updated',
|
|
245
257
|
)
|
|
246
|
-
brief_fields = (
|
|
258
|
+
brief_fields = (
|
|
259
|
+
'invoice',
|
|
260
|
+
'accounting_dimensions',
|
|
261
|
+
'amount',
|
|
262
|
+
'url',
|
|
263
|
+
'display',
|
|
264
|
+
'name',
|
|
265
|
+
)
|
|
247
266
|
|
|
248
267
|
|
|
249
268
|
class AccountingDimensionSerializer(NetBoxModelSerializer):
|
|
@@ -265,4 +284,4 @@ class AccountingDimensionSerializer(NetBoxModelSerializer):
|
|
|
265
284
|
'created',
|
|
266
285
|
'last_updated',
|
|
267
286
|
)
|
|
268
|
-
brief_fields = ('name', 'value', 'url', 'display')
|
|
287
|
+
brief_fields = ('id', 'name', 'value', 'url', 'display')
|
|
@@ -40,7 +40,9 @@ class ContractAssignmentViewSet(NetBoxModelViewSet):
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
class InvoiceLineViewSet(NetBoxModelViewSet):
|
|
43
|
-
queryset = models.InvoiceLine.objects.prefetch_related(
|
|
43
|
+
queryset = models.InvoiceLine.objects.prefetch_related(
|
|
44
|
+
'invoice', 'accounting_dimensions', 'tags'
|
|
45
|
+
)
|
|
44
46
|
serializer_class = InvoiceLineSerializer
|
|
45
47
|
|
|
46
48
|
|
|
@@ -61,7 +61,7 @@ class InvoiceLineFilterSet(NetBoxModelFilterSet):
|
|
|
61
61
|
|
|
62
62
|
def search(self, queryset, name, value):
|
|
63
63
|
return queryset.filter(
|
|
64
|
-
Q(comments__icontains=value) | Q(
|
|
64
|
+
Q(comments__icontains=value) | Q(invoice__number__icontains=value)
|
|
65
65
|
)
|
|
66
66
|
|
|
67
67
|
|
|
@@ -71,6 +71,4 @@ class AccountingDimensionFilterSet(NetBoxModelFilterSet):
|
|
|
71
71
|
fields = ('name', 'value')
|
|
72
72
|
|
|
73
73
|
def search(self, queryset, name, value):
|
|
74
|
-
return queryset.filter(
|
|
75
|
-
Q(comments__icontains=value) | Q(invoice__name__icontains=value)
|
|
76
|
-
)
|
|
74
|
+
return queryset.filter(Q(comments__icontains=value) | Q(name__icontains=value))
|
|
@@ -16,6 +16,7 @@ from utilities.forms.fields import (
|
|
|
16
16
|
CSVChoiceField,
|
|
17
17
|
CSVContentTypeField,
|
|
18
18
|
CSVModelChoiceField,
|
|
19
|
+
CSVModelMultipleChoiceField,
|
|
19
20
|
DynamicModelChoiceField,
|
|
20
21
|
DynamicModelMultipleChoiceField,
|
|
21
22
|
JSONField,
|
|
@@ -26,6 +27,7 @@ from utilities.forms.widgets import DatePicker, HTMXSelect
|
|
|
26
27
|
from .constants import SERVICE_PROVIDER_MODELS
|
|
27
28
|
from .models import (
|
|
28
29
|
AccountingDimension,
|
|
30
|
+
AccountingDimensionStatusChoices,
|
|
29
31
|
Contract,
|
|
30
32
|
ContractAssignment,
|
|
31
33
|
InternalEntityChoices,
|
|
@@ -147,7 +149,7 @@ class ContractForm(NetBoxModelForm):
|
|
|
147
149
|
def clean(self):
|
|
148
150
|
super().clean()
|
|
149
151
|
|
|
150
|
-
if self.cleaned_data['mrc'] and self.cleaned_data['
|
|
152
|
+
if self.cleaned_data['mrc'] and self.cleaned_data['yrc']:
|
|
151
153
|
raise ValidationError(
|
|
152
154
|
'you should set monthly OR yearly recuring costs not both'
|
|
153
155
|
)
|
|
@@ -239,6 +241,10 @@ class ContractBulkEditForm(NetBoxModelBulkEditForm):
|
|
|
239
241
|
|
|
240
242
|
|
|
241
243
|
class InvoiceForm(NetBoxModelForm):
|
|
244
|
+
number = forms.CharField(
|
|
245
|
+
max_length=100,
|
|
246
|
+
help_text='Invoice template name will be overriden to _invoice_template_contract name',
|
|
247
|
+
)
|
|
242
248
|
contracts = DynamicModelMultipleChoiceField(
|
|
243
249
|
queryset=Contract.objects.all(), required=False
|
|
244
250
|
)
|
|
@@ -458,7 +464,7 @@ class ContractAssignmentImportForm(NetBoxModelImportForm):
|
|
|
458
464
|
|
|
459
465
|
class InvoiceLineForm(NetBoxModelForm):
|
|
460
466
|
invoice = DynamicModelChoiceField(queryset=Invoice.objects.all())
|
|
461
|
-
accounting_dimensions =
|
|
467
|
+
accounting_dimensions = DynamicModelMultipleChoiceField(
|
|
462
468
|
queryset=AccountingDimension.objects.all(), required=False
|
|
463
469
|
)
|
|
464
470
|
|
|
@@ -488,9 +494,9 @@ class InvoiceLineForm(NetBoxModelForm):
|
|
|
488
494
|
|
|
489
495
|
class InvoiceLineFilterSetForm(NetBoxModelFilterSetForm):
|
|
490
496
|
model = InvoiceLine
|
|
491
|
-
invoice = DynamicModelChoiceField(queryset=Invoice.objects.all())
|
|
492
|
-
accounting_dimensions =
|
|
493
|
-
queryset=AccountingDimension.objects.all()
|
|
497
|
+
invoice = DynamicModelChoiceField(queryset=Invoice.objects.all(), required=False)
|
|
498
|
+
accounting_dimensions = DynamicModelChoiceField(
|
|
499
|
+
queryset=AccountingDimension.objects.all(), required=False
|
|
494
500
|
)
|
|
495
501
|
|
|
496
502
|
|
|
@@ -500,9 +506,10 @@ class InvoiceLineImportForm(NetBoxModelImportForm):
|
|
|
500
506
|
to_field_name='number',
|
|
501
507
|
help_text='Invoice number',
|
|
502
508
|
)
|
|
503
|
-
accounting_dimensions =
|
|
509
|
+
accounting_dimensions = CSVModelMultipleChoiceField(
|
|
504
510
|
queryset=AccountingDimension.objects.all(),
|
|
505
|
-
|
|
511
|
+
to_field_name='id',
|
|
512
|
+
help_text='accounting dimension id',
|
|
506
513
|
)
|
|
507
514
|
|
|
508
515
|
class Meta:
|
|
@@ -534,6 +541,7 @@ class AccountingDimensionForm(NetBoxModelForm):
|
|
|
534
541
|
fields = [
|
|
535
542
|
'name',
|
|
536
543
|
'value',
|
|
544
|
+
'status',
|
|
537
545
|
'comments',
|
|
538
546
|
'tags',
|
|
539
547
|
]
|
|
@@ -542,17 +550,26 @@ class AccountingDimensionForm(NetBoxModelForm):
|
|
|
542
550
|
class AccountingDimensionFilterSetForm(NetBoxModelFilterSetForm):
|
|
543
551
|
model = AccountingDimension
|
|
544
552
|
|
|
553
|
+
name = forms.CharField(required=False)
|
|
554
|
+
value = forms.CharField(required=False)
|
|
555
|
+
status = forms.ChoiceField(choices=AccountingDimensionStatusChoices, required=False)
|
|
556
|
+
|
|
545
557
|
|
|
546
558
|
class AccountingDimensionImportForm(NetBoxModelImportForm):
|
|
559
|
+
status = CSVChoiceField(choices=StatusChoices, help_text='Contract status')
|
|
560
|
+
|
|
547
561
|
class Meta:
|
|
548
562
|
model = AccountingDimension
|
|
549
563
|
fields = [
|
|
550
564
|
'name',
|
|
551
565
|
'value',
|
|
566
|
+
'status',
|
|
552
567
|
'comments',
|
|
553
568
|
'tags',
|
|
554
569
|
]
|
|
555
570
|
|
|
556
571
|
|
|
557
572
|
class AccountingDimensionBulkEditForm(NetBoxModelBulkEditForm):
|
|
573
|
+
name = forms.CharField(max_length=20, required=False)
|
|
574
|
+
value = forms.CharField(max_length=20, required=False)
|
|
558
575
|
model = AccountingDimension
|
netbox_contract-2.2.3/src/netbox_contract/migrations/0035_accountingdimension_status_and_more.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Generated by Django 5.0.6 on 2024-08-18 10:03
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
dependencies = [
|
|
8
|
+
('extras', '0115_convert_dashboard_widgets'),
|
|
9
|
+
('netbox_contract', '0034_contract_yrc_alter_contract_mrc'),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AddField(
|
|
14
|
+
model_name='accountingdimension',
|
|
15
|
+
name='status',
|
|
16
|
+
field=models.CharField(default='Active', max_length=50),
|
|
17
|
+
),
|
|
18
|
+
migrations.AddConstraint(
|
|
19
|
+
model_name='accountingdimension',
|
|
20
|
+
constraint=models.UniqueConstraint(
|
|
21
|
+
fields=('name', 'value'), name='unique_accounting_dimension'
|
|
22
|
+
),
|
|
23
|
+
),
|
|
24
|
+
]
|
netbox_contract-2.2.3/src/netbox_contract/migrations/0036_alter_invoiceline_accounting_dimensions.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Generated by Django 5.0.6 on 2024-08-18 19:37
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
dependencies = [
|
|
8
|
+
('netbox_contract', '0035_accountingdimension_status_and_more'),
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
operations = [
|
|
12
|
+
migrations.AlterField(
|
|
13
|
+
model_name='invoiceline',
|
|
14
|
+
name='accounting_dimensions',
|
|
15
|
+
field=models.ManyToManyField(
|
|
16
|
+
blank=True, to='netbox_contract.accountingdimension'
|
|
17
|
+
),
|
|
18
|
+
),
|
|
19
|
+
]
|
|
@@ -20,6 +20,18 @@ class StatusChoices(ChoiceSet):
|
|
|
20
20
|
]
|
|
21
21
|
|
|
22
22
|
|
|
23
|
+
class AccountingDimensionStatusChoices(ChoiceSet):
|
|
24
|
+
key = 'AccountingDimension.status'
|
|
25
|
+
|
|
26
|
+
STATUS_ACTIVE = 'Active'
|
|
27
|
+
STATUS_INACTIVE = 'Inactive'
|
|
28
|
+
|
|
29
|
+
CHOICES = [
|
|
30
|
+
(STATUS_ACTIVE, 'Active', 'green'),
|
|
31
|
+
(STATUS_INACTIVE, 'Inactive', 'red'),
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
|
|
23
35
|
class InternalEntityChoices(ChoiceSet):
|
|
24
36
|
key = 'Contract.internal_partie'
|
|
25
37
|
|
|
@@ -44,6 +56,11 @@ class CurrencyChoices(ChoiceSet):
|
|
|
44
56
|
class AccountingDimension(NetBoxModel):
|
|
45
57
|
name = models.CharField(max_length=20)
|
|
46
58
|
value = models.CharField(max_length=20)
|
|
59
|
+
status = models.CharField(
|
|
60
|
+
max_length=50,
|
|
61
|
+
choices=AccountingDimensionStatusChoices,
|
|
62
|
+
default=StatusChoices.STATUS_ACTIVE,
|
|
63
|
+
)
|
|
47
64
|
comments = models.TextField(blank=True)
|
|
48
65
|
|
|
49
66
|
def get_absolute_url(self):
|
|
@@ -56,6 +73,13 @@ class AccountingDimension(NetBoxModel):
|
|
|
56
73
|
def __str__(self):
|
|
57
74
|
return self.dimension
|
|
58
75
|
|
|
76
|
+
class Meta:
|
|
77
|
+
constraints = [
|
|
78
|
+
models.UniqueConstraint(
|
|
79
|
+
fields=['name', 'value'], name='unique_accounting_dimension'
|
|
80
|
+
)
|
|
81
|
+
]
|
|
82
|
+
|
|
59
83
|
|
|
60
84
|
class ServiceProvider(ContactsMixin, NetBoxModel):
|
|
61
85
|
name = models.CharField(max_length=100)
|
|
@@ -215,9 +239,7 @@ class InvoiceLine(NetBoxModel):
|
|
|
215
239
|
max_length=3, choices=CurrencyChoices, default=CurrencyChoices.CURRENCY_USD
|
|
216
240
|
)
|
|
217
241
|
amount = models.DecimalField(max_digits=10, decimal_places=2)
|
|
218
|
-
accounting_dimensions = models.ManyToManyField(
|
|
219
|
-
AccountingDimension, related_name='invoicelines', blank=True
|
|
220
|
-
)
|
|
242
|
+
accounting_dimensions = models.ManyToManyField(AccountingDimension, blank=True)
|
|
221
243
|
comments = models.TextField(blank=True)
|
|
222
244
|
|
|
223
245
|
def get_absolute_url(self):
|
|
@@ -182,6 +182,16 @@ urlpatterns = (
|
|
|
182
182
|
views.InvoiceLineBulkImportView.as_view(),
|
|
183
183
|
name='invoiceline_import',
|
|
184
184
|
),
|
|
185
|
+
path(
|
|
186
|
+
'invoiceline/edit/',
|
|
187
|
+
views.InvoiceLineBulkEditView.as_view(),
|
|
188
|
+
name='invoiceline_bulk_edit',
|
|
189
|
+
),
|
|
190
|
+
path(
|
|
191
|
+
'invoiceline/delete/',
|
|
192
|
+
views.InvoiceLineBulkDeleteView.as_view(),
|
|
193
|
+
name='invoiceline_bulk_delete',
|
|
194
|
+
),
|
|
185
195
|
path(
|
|
186
196
|
'invoiceline/<int:pk>/',
|
|
187
197
|
views.InvoiceLineView.as_view(),
|
|
@@ -219,6 +229,16 @@ urlpatterns = (
|
|
|
219
229
|
views.AccountingDimensionBulkImportView.as_view(),
|
|
220
230
|
name='accountingdimension_import',
|
|
221
231
|
),
|
|
232
|
+
path(
|
|
233
|
+
'accountingdimension/edit/',
|
|
234
|
+
views.AccountingDimensionBulkEditView.as_view(),
|
|
235
|
+
name='accountingdimension_bulk_edit',
|
|
236
|
+
),
|
|
237
|
+
path(
|
|
238
|
+
'accountingdimension/delete/',
|
|
239
|
+
views.AccountingDimensionBulkDeleteView.as_view(),
|
|
240
|
+
name='accountingdimension_bulk_delete',
|
|
241
|
+
),
|
|
222
242
|
path(
|
|
223
243
|
'accountingdimension/<int:pk>/',
|
|
224
244
|
views.AccountingDimensionView.as_view(),
|
|
@@ -278,7 +278,7 @@ class InvoiceEditView(generic.ObjectEditView):
|
|
|
278
278
|
contract = Contract.objects.get(pk=initial_data['contracts'])
|
|
279
279
|
|
|
280
280
|
try:
|
|
281
|
-
last_invoice = contract.invoices.
|
|
281
|
+
last_invoice = contract.invoices.exclude(template=True).latest(
|
|
282
282
|
'period_end'
|
|
283
283
|
)
|
|
284
284
|
new_period_start = last_invoice.period_end + timedelta(days=1)
|
|
@@ -58,6 +58,8 @@ src/netbox_contract/migrations/0031_contract_invoice_template_invoice_template.p
|
|
|
58
58
|
src/netbox_contract/migrations/0032_alter_invoice_period_end_alter_invoice_period_start_and_more.py
|
|
59
59
|
src/netbox_contract/migrations/0033_remove_contract_invoice_template.py
|
|
60
60
|
src/netbox_contract/migrations/0034_contract_yrc_alter_contract_mrc.py
|
|
61
|
+
src/netbox_contract/migrations/0035_accountingdimension_status_and_more.py
|
|
62
|
+
src/netbox_contract/migrations/0036_alter_invoiceline_accounting_dimensions.py
|
|
61
63
|
src/netbox_contract/migrations/__init__.py
|
|
62
64
|
src/netbox_contract/templates/contract_assignments_bottom.html
|
|
63
65
|
src/netbox_contract/templates/contract_list_bottom.html
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0001_initial.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0007_invoice_date.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract/migrations/0027_invoiceline.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_contract-2.2.1 → netbox_contract-2.2.3}/src/netbox_contract.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|