netbox-contract 2.2.0__tar.gz → 2.2.1__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.0/src/netbox_contract.egg-info → netbox_contract-2.2.1}/PKG-INFO +1 -1
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/pyproject.toml +1 -1
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/__init__.py +1 -1
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/api/views.py +6 -2
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/forms.py +15 -1
- netbox_contract-2.2.1/src/netbox_contract/migrations/0034_contract_yrc_alter_contract_mrc.py +26 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/models.py +12 -1
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/tables.py +3 -2
- netbox_contract-2.2.1/src/netbox_contract/templates/contract_assignments_bottom.html +23 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/templates/netbox_contract/contract.html +13 -7
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/templates/netbox_contract/invoice.html +6 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/views.py +27 -5
- {netbox_contract-2.2.0 → netbox_contract-2.2.1/src/netbox_contract.egg-info}/PKG-INFO +1 -1
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract.egg-info/SOURCES.txt +1 -1
- netbox_contract-2.2.0/src/netbox_contract/templates/contract_assignments_bottom.html +0 -21
- netbox_contract-2.2.0/src/netbox_contract/templates/contract_assignments_bottom_old.html +0 -23
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/LICENSE +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/MANIFEST.in +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/README.md +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/setup.cfg +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/setup.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/api/__init__.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/api/serializers.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/api/urls.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/constants.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/filtersets.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0001_initial.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0002_alter_contract_circuit_and_more.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0003_alter_contract_custom_field_data_and_more.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0004_contract_currency_invoice_currency.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0005_contract_accounting_dimensions_and_more.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0006_alter_contract_circuit.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0007_invoice_date.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0008_invoice_comments.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0009_contract_external_reference.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0010_invoice_contracts.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0011_auto_20230122_2112.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0012_remove_invoice_contract.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0013_contract_documents_invoice_documents.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0014_contract_end_date.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0015_contractassignement.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0016_contract_parent.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0017_alter_contract_accounting_dimensions.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0018_contract_external_partie_object_id_and_more.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0019_auto_20230924_1813.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0020_alter_contract_external_partie.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0021_alter_contract_external_partie.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0022_alter_contract_internal_partie_alter_contract_parent.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0023_rename_contractassignement_contractassignment_and_more.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0024_remove_contract_external_partie.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0025_remove_contract_circuit_and_more.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0026_auto_20240421_1550.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0027_invoiceline.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0028_invoiceline_accounting_dimensions.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0029_remove_invoiceline_accounting_dimensions_and_more.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0030_alter_invoiceline_accounting_dimensions.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0031_contract_invoice_template_invoice_template.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0032_alter_invoice_period_end_alter_invoice_period_start_and_more.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/0033_remove_contract_invoice_template.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/migrations/__init__.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/navigation.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/search.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/template_content.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/templates/contract_list_bottom.html +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/templates/netbox_contract/accountingdimension.html +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/templates/netbox_contract/contractassignment.html +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/templates/netbox_contract/invoiceline.html +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/templates/netbox_contract/serviceprovider.html +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract/urls.py +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract.egg-info/dependency_links.txt +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract.egg-info/not-zip-safe +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract.egg-info/requires.txt +0 -0
- {netbox_contract-2.2.0 → netbox_contract-2.2.1}/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.1'
|
|
9
9
|
author = 'Marc Lebreuil'
|
|
10
10
|
author_email = 'marc@famillelebreuil.net'
|
|
11
11
|
base_url = 'contracts'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
from django.db.models import F
|
|
1
|
+
from django.db.models import Case, F, When
|
|
2
|
+
from django.db.models.functions import Round
|
|
2
3
|
from netbox.api.viewsets import NetBoxModelViewSet
|
|
3
4
|
|
|
4
5
|
from .. import filtersets, models
|
|
@@ -14,7 +15,10 @@ from .serializers import (
|
|
|
14
15
|
|
|
15
16
|
class ContractViewSet(NetBoxModelViewSet):
|
|
16
17
|
queryset = models.Contract.objects.prefetch_related('parent', 'tags').annotate(
|
|
17
|
-
|
|
18
|
+
calculated_rc=Round(
|
|
19
|
+
Case(When(yrc__gt=0, then=F('yrc') / 12), default=F('mrc') * 12),
|
|
20
|
+
precision=2,
|
|
21
|
+
)
|
|
18
22
|
)
|
|
19
23
|
serializer_class = ContractSerializer
|
|
20
24
|
|
|
@@ -129,6 +129,7 @@ class ContractForm(NetBoxModelForm):
|
|
|
129
129
|
'renewal_term',
|
|
130
130
|
'currency',
|
|
131
131
|
'accounting_dimensions',
|
|
132
|
+
'yrc',
|
|
132
133
|
'mrc',
|
|
133
134
|
'nrc',
|
|
134
135
|
'invoice_frequency',
|
|
@@ -143,6 +144,14 @@ class ContractForm(NetBoxModelForm):
|
|
|
143
144
|
'end_date': DatePicker(),
|
|
144
145
|
}
|
|
145
146
|
|
|
147
|
+
def clean(self):
|
|
148
|
+
super().clean()
|
|
149
|
+
|
|
150
|
+
if self.cleaned_data['mrc'] and self.cleaned_data['mrc']:
|
|
151
|
+
raise ValidationError(
|
|
152
|
+
'you should set monthly OR yearly recuring costs not both'
|
|
153
|
+
)
|
|
154
|
+
|
|
146
155
|
|
|
147
156
|
class ContractFilterSetForm(NetBoxModelFilterSetForm):
|
|
148
157
|
model = Contract
|
|
@@ -193,6 +202,7 @@ class ContractCSVForm(NetBoxModelImportForm):
|
|
|
193
202
|
'renewal_term',
|
|
194
203
|
'currency',
|
|
195
204
|
'accounting_dimensions',
|
|
205
|
+
'yrc',
|
|
196
206
|
'mrc',
|
|
197
207
|
'nrc',
|
|
198
208
|
'invoice_frequency',
|
|
@@ -261,7 +271,11 @@ class InvoiceForm(NetBoxModelForm):
|
|
|
261
271
|
)
|
|
262
272
|
|
|
263
273
|
# Prefix the invoice name with _template
|
|
264
|
-
self.cleaned_data['number'] = '
|
|
274
|
+
self.cleaned_data['number'] = '_invoice_template_' + contract.name
|
|
275
|
+
|
|
276
|
+
# set the periode start and end date to null
|
|
277
|
+
self.cleaned_data['period_start'] = None
|
|
278
|
+
self.cleaned_data['period_end'] = None
|
|
265
279
|
|
|
266
280
|
def save(self, *args, **kwargs):
|
|
267
281
|
is_new = not bool(self.instance.pk)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Generated by Django 5.0.6 on 2024-08-01 15:43
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
dependencies = [
|
|
8
|
+
('netbox_contract', '0033_remove_contract_invoice_template'),
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
operations = [
|
|
12
|
+
migrations.AddField(
|
|
13
|
+
model_name='contract',
|
|
14
|
+
name='yrc',
|
|
15
|
+
field=models.DecimalField(
|
|
16
|
+
blank=True, decimal_places=2, max_digits=10, null=True
|
|
17
|
+
),
|
|
18
|
+
),
|
|
19
|
+
migrations.AlterField(
|
|
20
|
+
model_name='contract',
|
|
21
|
+
name='mrc',
|
|
22
|
+
field=models.DecimalField(
|
|
23
|
+
blank=True, decimal_places=2, max_digits=10, null=True
|
|
24
|
+
),
|
|
25
|
+
),
|
|
26
|
+
]
|
|
@@ -130,8 +130,19 @@ class Contract(NetBoxModel):
|
|
|
130
130
|
max_length=3, choices=CurrencyChoices, default=CurrencyChoices.CURRENCY_USD
|
|
131
131
|
)
|
|
132
132
|
accounting_dimensions = models.JSONField(null=True, blank=True)
|
|
133
|
+
yrc = models.DecimalField(
|
|
134
|
+
verbose_name='yearly recuring cost',
|
|
135
|
+
max_digits=10,
|
|
136
|
+
decimal_places=2,
|
|
137
|
+
blank=True,
|
|
138
|
+
null=True,
|
|
139
|
+
)
|
|
133
140
|
mrc = models.DecimalField(
|
|
134
|
-
verbose_name='Monthly recuring cost',
|
|
141
|
+
verbose_name='Monthly recuring cost',
|
|
142
|
+
max_digits=10,
|
|
143
|
+
decimal_places=2,
|
|
144
|
+
blank=True,
|
|
145
|
+
null=True,
|
|
135
146
|
)
|
|
136
147
|
nrc = models.DecimalField(
|
|
137
148
|
verbose_name='None recuring cost', default=0, max_digits=10, decimal_places=2
|
|
@@ -42,14 +42,15 @@ class ContractAssignmentListTable(NetBoxTable):
|
|
|
42
42
|
class ContractAssignmentObjectTable(NetBoxTable):
|
|
43
43
|
contract = tables.Column(linkify=True)
|
|
44
44
|
actions = columns.ActionsColumn(actions=('edit', 'delete'))
|
|
45
|
-
contract__external_partie_object = tables.Column(
|
|
45
|
+
contract__external_partie_object = tables.Column(
|
|
46
|
+
verbose_name='Partner', linkify=True
|
|
47
|
+
)
|
|
46
48
|
|
|
47
49
|
class Meta(NetBoxTable.Meta):
|
|
48
50
|
model = ContractAssignment
|
|
49
51
|
fields = (
|
|
50
52
|
'pk',
|
|
51
53
|
'contract',
|
|
52
|
-
'contract__external_partie_object_type',
|
|
53
54
|
'contract__external_partie_object',
|
|
54
55
|
'contract__status',
|
|
55
56
|
'contract__start_date',
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{% load render_table from django_tables2 %}
|
|
2
|
+
{% if perms.netbox_contract.view_contract %}
|
|
3
|
+
<div class="row">
|
|
4
|
+
<div class="col col-md-12">
|
|
5
|
+
<div class="card">
|
|
6
|
+
<h5 class="card-header">
|
|
7
|
+
Contracts Assignments
|
|
8
|
+
{% if perms.netbox_contract.add_contractassignment %}
|
|
9
|
+
<div class="card-actions">
|
|
10
|
+
<a href="{% url 'plugins:netbox_contract:contractassignment_add' %}?content_type={{ object|content_type_id }}&object_id={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-ghost-primary btn-sm">
|
|
11
|
+
<i class="mdi mdi-plus-thick" aria-hidden="true"></i>
|
|
12
|
+
Add assignment
|
|
13
|
+
</a>
|
|
14
|
+
</div>
|
|
15
|
+
{% endif %}
|
|
16
|
+
</h5>
|
|
17
|
+
{% if assignments_table %}
|
|
18
|
+
{% render_table assignments_table %}
|
|
19
|
+
{% endif %}
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
{% endif %}
|
|
@@ -85,6 +85,10 @@
|
|
|
85
85
|
<th scope="row">Yearly recuring costs</th>
|
|
86
86
|
<td>{{ object.yrc }}</td>
|
|
87
87
|
</tr>
|
|
88
|
+
<tr>
|
|
89
|
+
<th scope="row">calculated corresponding Yearly or Monthly value</th>
|
|
90
|
+
<td>{{ object.calculated_rc }}</td>
|
|
91
|
+
</tr>
|
|
88
92
|
<tr>
|
|
89
93
|
<th scope="row">Non recuring costs</th>
|
|
90
94
|
<td>{{ object.nrc }}</td>
|
|
@@ -138,16 +142,18 @@
|
|
|
138
142
|
<div class="row">
|
|
139
143
|
<div class="col col-md-12">
|
|
140
144
|
<div class="card">
|
|
141
|
-
<h5 class="card-header">
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
<h5 class="card-header">
|
|
146
|
+
Invoices
|
|
147
|
+
{% if perms.netbox_contract.add_invoice %}
|
|
148
|
+
<div class="card-actions">
|
|
149
|
+
<a href="{% url 'plugins:netbox_contract:invoice_add' %}?contracts={{ object.pk }}" class="btn btn-ghost-primary btn-sm">
|
|
146
150
|
<i class="mdi mdi-plus-thick" aria-hidden="true"></i>
|
|
147
151
|
Add an invoice
|
|
148
152
|
</a>
|
|
149
|
-
|
|
150
|
-
|
|
153
|
+
</div>
|
|
154
|
+
{% endif %}
|
|
155
|
+
</h5>
|
|
156
|
+
{% render_table invoices_table %}
|
|
151
157
|
</div>
|
|
152
158
|
</div>
|
|
153
159
|
</div>
|
|
@@ -19,10 +19,15 @@
|
|
|
19
19
|
<th scope="row">Number</th>
|
|
20
20
|
<td>{{ object.number }}</td>
|
|
21
21
|
</tr>
|
|
22
|
+
<tr>
|
|
23
|
+
<th scope="row">Template</th>
|
|
24
|
+
<td>{{ object.template }}</td>
|
|
25
|
+
</tr>
|
|
22
26
|
<tr>
|
|
23
27
|
<th scope="row">Date</th>
|
|
24
28
|
<td>{{ object.date }}</td>
|
|
25
29
|
</tr>
|
|
30
|
+
{% if not object.template %}
|
|
26
31
|
<tr>
|
|
27
32
|
<th scope="row">Period start</th>
|
|
28
33
|
<td>{{ object.period_start }}</td>
|
|
@@ -31,6 +36,7 @@
|
|
|
31
36
|
<th scope="row">Period end</th>
|
|
32
37
|
<td>{{ object.period_end }}</td>
|
|
33
38
|
</tr>
|
|
39
|
+
{% endif %}
|
|
34
40
|
<tr>
|
|
35
41
|
<th scope="row">Currency</th>
|
|
36
42
|
<td>{{ object.currency }}</td>
|
|
@@ -4,7 +4,8 @@ from dateutil.relativedelta import relativedelta
|
|
|
4
4
|
from django.conf import settings
|
|
5
5
|
from django.contrib.contenttypes.models import ContentType
|
|
6
6
|
from django.core.exceptions import ObjectDoesNotExist
|
|
7
|
-
from django.db.models import F
|
|
7
|
+
from django.db.models import Case, F, When
|
|
8
|
+
from django.db.models.functions import Round
|
|
8
9
|
from django.shortcuts import get_object_or_404, render
|
|
9
10
|
from netbox.views import generic
|
|
10
11
|
from netbox.views.generic.utils import get_prerequisite_model
|
|
@@ -129,7 +130,12 @@ class ContractAssignmentBulkImportView(generic.BulkImportView):
|
|
|
129
130
|
|
|
130
131
|
@register_model_view(Contract)
|
|
131
132
|
class ContractView(generic.ObjectView):
|
|
132
|
-
queryset = Contract.objects.annotate(
|
|
133
|
+
queryset = Contract.objects.annotate(
|
|
134
|
+
calculated_rc=Round(
|
|
135
|
+
Case(When(yrc__gt=0, then=F('yrc') / 12), default=F('mrc') * 12),
|
|
136
|
+
precision=2,
|
|
137
|
+
)
|
|
138
|
+
)
|
|
133
139
|
|
|
134
140
|
def get_extra_context(self, request, instance):
|
|
135
141
|
invoices_table = tables.InvoiceListTable(instance.invoices.all())
|
|
@@ -152,7 +158,12 @@ class ContractView(generic.ObjectView):
|
|
|
152
158
|
|
|
153
159
|
|
|
154
160
|
class ContractListView(generic.ObjectListView):
|
|
155
|
-
queryset = Contract.objects.annotate(
|
|
161
|
+
queryset = Contract.objects.annotate(
|
|
162
|
+
calculated_rc=Round(
|
|
163
|
+
Case(When(yrc__gt=0, then=F('yrc') / 12), default=F('mrc') * 12),
|
|
164
|
+
precision=2,
|
|
165
|
+
)
|
|
166
|
+
)
|
|
156
167
|
table = tables.ContractListTable
|
|
157
168
|
filterset = filtersets.ContractFilterSet
|
|
158
169
|
filterset_form = forms.ContractFilterSetForm
|
|
@@ -267,7 +278,9 @@ class InvoiceEditView(generic.ObjectEditView):
|
|
|
267
278
|
contract = Contract.objects.get(pk=initial_data['contracts'])
|
|
268
279
|
|
|
269
280
|
try:
|
|
270
|
-
last_invoice = contract.invoices.latest(
|
|
281
|
+
last_invoice = contract.invoices.filter(template=False).latest(
|
|
282
|
+
'period_end'
|
|
283
|
+
)
|
|
271
284
|
new_period_start = last_invoice.period_end + timedelta(days=1)
|
|
272
285
|
except ObjectDoesNotExist:
|
|
273
286
|
if contract.start_date:
|
|
@@ -281,7 +294,16 @@ class InvoiceEditView(generic.ObjectEditView):
|
|
|
281
294
|
new_period_end = new_period_start + delta - timedelta(days=1)
|
|
282
295
|
initial_data['period_end'] = new_period_end
|
|
283
296
|
|
|
284
|
-
|
|
297
|
+
if contract.yrc:
|
|
298
|
+
if contract.invoice_frequency == 12:
|
|
299
|
+
initial_data['amount'] = contract.yrc
|
|
300
|
+
else:
|
|
301
|
+
initial_data['amount'] = round(
|
|
302
|
+
contract.yrc / 12 * contract.invoice_frequency, 2
|
|
303
|
+
)
|
|
304
|
+
else:
|
|
305
|
+
initial_data['amount'] = contract.mrc * contract.invoice_frequency
|
|
306
|
+
|
|
285
307
|
initial_data['currency'] = contract.currency
|
|
286
308
|
if contract.accounting_dimensions:
|
|
287
309
|
initial_data['accounting_dimensions'] = contract.accounting_dimensions
|
|
@@ -57,9 +57,9 @@ src/netbox_contract/migrations/0030_alter_invoiceline_accounting_dimensions.py
|
|
|
57
57
|
src/netbox_contract/migrations/0031_contract_invoice_template_invoice_template.py
|
|
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
|
+
src/netbox_contract/migrations/0034_contract_yrc_alter_contract_mrc.py
|
|
60
61
|
src/netbox_contract/migrations/__init__.py
|
|
61
62
|
src/netbox_contract/templates/contract_assignments_bottom.html
|
|
62
|
-
src/netbox_contract/templates/contract_assignments_bottom_old.html
|
|
63
63
|
src/netbox_contract/templates/contract_list_bottom.html
|
|
64
64
|
src/netbox_contract/templates/netbox_contract/accountingdimension.html
|
|
65
65
|
src/netbox_contract/templates/netbox_contract/contract.html
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{% load render_table from django_tables2 %}
|
|
2
|
-
{% if perms.netbox_contract.view_contract %}
|
|
3
|
-
<div class="row">
|
|
4
|
-
<div class="col col-md-12">
|
|
5
|
-
<div class="card">
|
|
6
|
-
<h5 class="card-header">Contracts Assignments</h5>
|
|
7
|
-
{% if assignments_table %}
|
|
8
|
-
{% render_table assignments_table %}
|
|
9
|
-
{% endif %}
|
|
10
|
-
{% if perms.netbox_contract.add_contractassignment %}
|
|
11
|
-
<div class="card-footer text-end noprint">
|
|
12
|
-
<a href="{% url 'plugins:netbox_contract:contractassignment_add' %}?content_type={{ object|content_type_id }}&object_id={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-primary">
|
|
13
|
-
<i class="mdi mdi-plus-thick" aria-hidden="true"></i>
|
|
14
|
-
Add assignment
|
|
15
|
-
</a>
|
|
16
|
-
</div>
|
|
17
|
-
{% endif %}
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
{% endif %}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{% load render_table from django_tables2 %}
|
|
2
|
-
{% if perms.netbox_contract.view_contract %}
|
|
3
|
-
<div class="row">
|
|
4
|
-
<div class="col col-md-12">
|
|
5
|
-
<div class="card">
|
|
6
|
-
<h5 class="card-header">Contracts Assignments</h5>
|
|
7
|
-
{% if assignments_table %}
|
|
8
|
-
<div class="card-body table-responsive">
|
|
9
|
-
{% render_table assignments_table %}
|
|
10
|
-
</div>
|
|
11
|
-
{% endif %}
|
|
12
|
-
{% if perms.netbox_contract.add_contractassignment %}
|
|
13
|
-
<div class="card-footer text-end noprint">
|
|
14
|
-
<a href="{% url 'plugins:netbox_contract:contractassignment_add' %}?content_type={{ object|content_type_id }}&object_id={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-primary">
|
|
15
|
-
<i class="mdi mdi-plus-thick" aria-hidden="true"></i>
|
|
16
|
-
Add assignment
|
|
17
|
-
</a>
|
|
18
|
-
</div>
|
|
19
|
-
{% endif %}
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
{% endif %}
|
|
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.0 → netbox_contract-2.2.1}/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.0 → netbox_contract-2.2.1}/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.0 → netbox_contract-2.2.1}/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
|
{netbox_contract-2.2.0 → netbox_contract-2.2.1}/src/netbox_contract.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|