netbox-contract 2.2.7__tar.gz → 2.2.10__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.
Files changed (75) hide show
  1. {netbox_contract-2.2.7/src/netbox_contract.egg-info → netbox_contract-2.2.10}/PKG-INFO +3 -2
  2. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/README.md +2 -1
  3. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/pyproject.toml +1 -1
  4. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/__init__.py +2 -2
  5. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/forms.py +191 -65
  6. netbox_contract-2.2.10/src/netbox_contract/migrations/0037_contract_notice_period_alter_contract_currency_and_more.py +32 -0
  7. netbox_contract-2.2.10/src/netbox_contract/models.py +372 -0
  8. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/navigation.py +13 -12
  9. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/templates/contract_assignments_bottom.html +2 -2
  10. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/templates/contract_list_bottom.html +1 -1
  11. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/templates/netbox_contract/accountingdimension.html +5 -4
  12. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/templates/netbox_contract/contract.html +41 -34
  13. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/templates/netbox_contract/contractassignment.html +5 -4
  14. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/templates/netbox_contract/invoice.html +16 -15
  15. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/templates/netbox_contract/invoiceline.html +6 -5
  16. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/templates/netbox_contract/serviceprovider.html +4 -5
  17. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/views.py +6 -6
  18. {netbox_contract-2.2.7 → netbox_contract-2.2.10/src/netbox_contract.egg-info}/PKG-INFO +3 -2
  19. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract.egg-info/SOURCES.txt +1 -0
  20. netbox_contract-2.2.7/src/netbox_contract/models.py +0 -266
  21. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/LICENSE +0 -0
  22. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/MANIFEST.in +0 -0
  23. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/setup.cfg +0 -0
  24. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/setup.py +0 -0
  25. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/api/__init__.py +0 -0
  26. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/api/serializers.py +0 -0
  27. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/api/urls.py +0 -0
  28. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/api/views.py +0 -0
  29. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/constants.py +0 -0
  30. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/filtersets.py +0 -0
  31. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0001_initial.py +0 -0
  32. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0002_alter_contract_circuit_and_more.py +0 -0
  33. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0003_alter_contract_custom_field_data_and_more.py +0 -0
  34. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0004_contract_currency_invoice_currency.py +0 -0
  35. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0005_contract_accounting_dimensions_and_more.py +0 -0
  36. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0006_alter_contract_circuit.py +0 -0
  37. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0007_invoice_date.py +0 -0
  38. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0008_invoice_comments.py +0 -0
  39. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0009_contract_external_reference.py +0 -0
  40. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0010_invoice_contracts.py +0 -0
  41. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0011_auto_20230122_2112.py +0 -0
  42. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0012_remove_invoice_contract.py +0 -0
  43. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0013_contract_documents_invoice_documents.py +0 -0
  44. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0014_contract_end_date.py +0 -0
  45. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0015_contractassignement.py +0 -0
  46. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0016_contract_parent.py +0 -0
  47. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0017_alter_contract_accounting_dimensions.py +0 -0
  48. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0018_contract_external_partie_object_id_and_more.py +0 -0
  49. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0019_auto_20230924_1813.py +0 -0
  50. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0020_alter_contract_external_partie.py +0 -0
  51. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0021_alter_contract_external_partie.py +0 -0
  52. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0022_alter_contract_internal_partie_alter_contract_parent.py +0 -0
  53. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0023_rename_contractassignement_contractassignment_and_more.py +0 -0
  54. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0024_remove_contract_external_partie.py +0 -0
  55. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0025_remove_contract_circuit_and_more.py +0 -0
  56. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0026_auto_20240421_1550.py +0 -0
  57. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0027_invoiceline.py +0 -0
  58. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0028_invoiceline_accounting_dimensions.py +0 -0
  59. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0029_remove_invoiceline_accounting_dimensions_and_more.py +0 -0
  60. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0030_alter_invoiceline_accounting_dimensions.py +0 -0
  61. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0031_contract_invoice_template_invoice_template.py +0 -0
  62. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0032_alter_invoice_period_end_alter_invoice_period_start_and_more.py +0 -0
  63. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0033_remove_contract_invoice_template.py +0 -0
  64. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0034_contract_yrc_alter_contract_mrc.py +0 -0
  65. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0035_accountingdimension_status_and_more.py +0 -0
  66. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/0036_alter_invoiceline_accounting_dimensions.py +0 -0
  67. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/migrations/__init__.py +0 -0
  68. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/search.py +0 -0
  69. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/tables.py +0 -0
  70. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/template_content.py +0 -0
  71. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract/urls.py +0 -0
  72. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract.egg-info/dependency_links.txt +0 -0
  73. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract.egg-info/not-zip-safe +0 -0
  74. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract.egg-info/requires.txt +0 -0
  75. {netbox_contract-2.2.7 → netbox_contract-2.2.10}/src/netbox_contract.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: netbox-contract
3
- Version: 2.2.7
3
+ Version: 2.2.10
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
@@ -73,13 +73,14 @@ PLUGINS_CONFIG = {
73
73
  ```
74
74
 
75
75
  * top_level_menu : If "Contracts" appears under the "Plugins" menu item or on its own
76
- * default_accounting_dimensions: The accounting dimensions which will appear in the field' background when empty.
76
+ * default_accounting_dimensions: The accounting dimensions which will appear in the field' background when empty. Note that accounting dimensions are now managed as individual objects. The use of this field is deprecated.
77
77
  * mandatory_contract_fields, mandatory_invoice_fields: Fields which are not required by default and can be set as such. The list of fields is at the bottom of the contract import form.
78
78
  * hidden_contract_fields, hidden_invoice_fields: List of fields to be hidden. Fields should not be required to be hidden.
79
79
 
80
80
  ### Customize the plugin fields choices
81
81
 
82
82
  Internal partie reference the legal entity of your organization that is a partie to the contract.
83
+ The first currency will also be the default currency for contracts.
83
84
 
84
85
  ```python
85
86
  # configuration.py
@@ -57,13 +57,14 @@ PLUGINS_CONFIG = {
57
57
  ```
58
58
 
59
59
  * top_level_menu : If "Contracts" appears under the "Plugins" menu item or on its own
60
- * default_accounting_dimensions: The accounting dimensions which will appear in the field' background when empty.
60
+ * default_accounting_dimensions: The accounting dimensions which will appear in the field' background when empty. Note that accounting dimensions are now managed as individual objects. The use of this field is deprecated.
61
61
  * mandatory_contract_fields, mandatory_invoice_fields: Fields which are not required by default and can be set as such. The list of fields is at the bottom of the contract import form.
62
62
  * hidden_contract_fields, hidden_invoice_fields: List of fields to be hidden. Fields should not be required to be hidden.
63
63
 
64
64
  ### Customize the plugin fields choices
65
65
 
66
66
  Internal partie reference the legal entity of your organization that is a partie to the contract.
67
+ The first currency will also be the default currency for contracts.
67
68
 
68
69
  ```python
69
70
  # configuration.py
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "netbox-contract"
3
- version = "2.2.7"
3
+ version = "2.2.10"
4
4
  authors = [
5
5
  { name="Marc Lebreuil", email="marc@famillelebreuil.net" },
6
6
  ]
@@ -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.2.7'
8
+ version = '2.2.10'
9
9
  author = 'Marc Lebreuil'
10
10
  author_email = 'marc@famillelebreuil.net'
11
11
  base_url = 'contracts'
12
- min_version = '4.0.2'
12
+ min_version = '4.1.10'
13
13
  required_settings = []
14
14
  default_settings = {
15
15
  'top_level_menu': False,
@@ -2,6 +2,7 @@ from django import forms
2
2
  from django.conf import settings
3
3
  from django.contrib.contenttypes.models import ContentType
4
4
  from django.core.exceptions import ObjectDoesNotExist, ValidationError
5
+ from django.utils.translation import gettext_lazy as _
5
6
  from netbox.forms import (
6
7
  NetBoxModelBulkEditForm,
7
8
  NetBoxModelFilterSetForm,
@@ -42,6 +43,9 @@ from .models import (
42
43
  plugin_settings = settings.PLUGINS_CONFIG['netbox_contract']
43
44
  default_dimensions = plugin_settings.get('default_accounting_dimensions')
44
45
 
46
+ # Dimensions
47
+ # Deprecated. To be removed in version 3.0
48
+
45
49
 
46
50
  class Dimensions(JSONField):
47
51
  """
@@ -57,17 +61,27 @@ class Dimensions(JSONField):
57
61
 
58
62
 
59
63
  class ContractForm(NetBoxModelForm):
60
- comments = CommentField()
64
+ comments = CommentField(label=_('Comments'))
61
65
 
62
66
  external_partie_object_type = ContentTypeChoiceField(
63
67
  queryset=ContentType.objects.all(),
64
68
  limit_choices_to=SERVICE_PROVIDER_MODELS,
65
69
  widget=HTMXSelect(),
70
+ label=_('External partie object type'),
71
+ )
72
+ external_partie_object = forms.ModelChoiceField(
73
+ queryset=None, label=_('External partie object')
74
+ )
75
+ tenant = DynamicModelChoiceField(
76
+ queryset=Tenant.objects.all(), required=False, selector=True, label=_('Tenant')
66
77
  )
67
- external_partie_object = forms.ModelChoiceField(queryset=None)
68
- tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False)
69
- parent = DynamicModelChoiceField(queryset=Contract.objects.all(), required=False)
70
- accounting_dimensions = Dimensions(required=False)
78
+ parent = DynamicModelChoiceField(
79
+ queryset=Contract.objects.all(),
80
+ required=False,
81
+ selector=True,
82
+ label=_('Parent'),
83
+ )
84
+ accounting_dimensions = Dimensions(required=False, label=_('Accounting dimensions'))
71
85
 
72
86
  def __init__(self, *args, **kwargs):
73
87
  initial = kwargs.get('initial', None)
@@ -131,6 +145,7 @@ class ContractForm(NetBoxModelForm):
131
145
  'end_date',
132
146
  'initial_term',
133
147
  'renewal_term',
148
+ 'notice_period',
134
149
  'currency',
135
150
  'accounting_dimensions',
136
151
  'yrc',
@@ -157,15 +172,26 @@ class ContractForm(NetBoxModelForm):
157
172
  )
158
173
 
159
174
 
160
- class ContractFilterSetForm(NetBoxModelFilterSetForm):
175
+ class ContractFilterForm(NetBoxModelFilterSetForm):
161
176
  model = Contract
162
177
 
163
- tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False)
164
- external_reference = forms.CharField(required=False)
165
- internal_partie = forms.ChoiceField(choices=InternalEntityChoices, required=False)
166
- status = forms.ChoiceField(choices=StatusChoices, required=False)
167
- currency = forms.ChoiceField(choices=CurrencyChoices, required=False)
168
- parent = DynamicModelChoiceField(queryset=Contract.objects.all(), required=False)
178
+ tenant = DynamicModelChoiceField(
179
+ queryset=Tenant.objects.all(), required=False, selector=True, label=_('Tenant')
180
+ )
181
+ external_reference = forms.CharField(required=False, label=_('External reference'))
182
+ internal_partie = forms.ChoiceField(
183
+ choices=InternalEntityChoices, required=False, label=_('Internal partie')
184
+ )
185
+ status = forms.ChoiceField(choices=StatusChoices, required=False, label=_('Status'))
186
+ currency = forms.ChoiceField(
187
+ choices=CurrencyChoices, required=False, label=_('Currency')
188
+ )
189
+ parent = DynamicModelChoiceField(
190
+ queryset=Contract.objects.all(),
191
+ required=False,
192
+ selector=True,
193
+ label=_('Parent'),
194
+ )
169
195
  tag = TagFilterField(model)
170
196
 
171
197
 
@@ -176,20 +202,24 @@ class ContractCSVForm(NetBoxModelImportForm):
176
202
  help_text='service provider object type in the form <app>.<model>',
177
203
  )
178
204
  external_partie_object_id = forms.CharField(
179
- help_text='service provider object name', label='external_partie_name'
205
+ help_text='service provider object name', label=_('External partie name')
180
206
  )
181
207
  tenant = CSVModelChoiceField(
182
208
  queryset=Tenant.objects.all(),
183
209
  to_field_name='name',
184
210
  help_text='Tenant name',
185
211
  required=False,
212
+ label=_('Tenant'),
213
+ )
214
+ status = CSVChoiceField(
215
+ choices=StatusChoices, help_text='Contract status', label=_('Status')
186
216
  )
187
- status = CSVChoiceField(choices=StatusChoices, help_text='Contract status')
188
217
  parent = CSVModelChoiceField(
189
218
  queryset=Contract.objects.all(),
190
219
  to_field_name='name',
191
220
  help_text='Contract name',
192
221
  required=False,
222
+ label=_('Parent'),
193
223
  )
194
224
 
195
225
  class Meta:
@@ -230,13 +260,24 @@ class ContractCSVForm(NetBoxModelImportForm):
230
260
 
231
261
 
232
262
  class ContractBulkEditForm(NetBoxModelBulkEditForm):
233
- name = forms.CharField(max_length=100, required=False)
234
- external_reference = forms.CharField(max_length=100, required=False)
235
- internal_partie = forms.ChoiceField(choices=InternalEntityChoices, required=False)
236
- tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False)
237
- accounting_dimensions = Dimensions(required=False)
238
- comments = CommentField(required=False)
239
- parent = DynamicModelChoiceField(queryset=Contract.objects.all(), required=False)
263
+ name = forms.CharField(max_length=100, required=False, label=_('Name'))
264
+ external_reference = forms.CharField(
265
+ max_length=100, required=False, label=_('External reference')
266
+ )
267
+ internal_partie = forms.ChoiceField(
268
+ choices=InternalEntityChoices, required=False, label=_('Internal partie')
269
+ )
270
+ tenant = DynamicModelChoiceField(
271
+ queryset=Tenant.objects.all(), required=False, selector=True, label=_('Tenant')
272
+ )
273
+ accounting_dimensions = Dimensions(required=False, label=_('Accounting dimensions'))
274
+ comments = CommentField(required=False, label=_('Comments'))
275
+ parent = DynamicModelChoiceField(
276
+ queryset=Contract.objects.all(),
277
+ required=False,
278
+ selector=True,
279
+ label=_('Parent'),
280
+ )
240
281
 
241
282
  nullable_fields = (
242
283
  'accounting_dimensions',
@@ -252,11 +293,15 @@ class InvoiceForm(NetBoxModelForm):
252
293
  number = forms.CharField(
253
294
  max_length=100,
254
295
  help_text='Invoice template name will be overriden to _invoice_template_contract name',
296
+ label=_('Number'),
255
297
  )
256
298
  contracts = DynamicModelMultipleChoiceField(
257
- queryset=Contract.objects.all(), required=False
299
+ queryset=Contract.objects.all(),
300
+ required=False,
301
+ selector=True,
302
+ label=_('Contracts'),
258
303
  )
259
- accounting_dimensions = Dimensions(required=False)
304
+ accounting_dimensions = Dimensions(required=False, label=_('Accounting dimensions'))
260
305
 
261
306
  def __init__(self, *args, **kwargs):
262
307
  super().__init__(*args, **kwargs)
@@ -360,15 +405,25 @@ class InvoiceForm(NetBoxModelForm):
360
405
  }
361
406
 
362
407
 
363
- class InvoiceFilterSetForm(NetBoxModelFilterSetForm):
408
+ class InvoiceFilterForm(NetBoxModelFilterSetForm):
364
409
  model = Invoice
365
- number = forms.CharField(required=False)
410
+ number = forms.CharField(
411
+ required=False,
412
+ label=_('Number'),
413
+ )
366
414
  template = forms.NullBooleanField(
367
- required=False, widget=forms.Select(choices=BOOLEAN_WITH_BLANK_CHOICES)
415
+ required=False,
416
+ widget=forms.Select(choices=BOOLEAN_WITH_BLANK_CHOICES),
417
+ label=_('Template'),
418
+ )
419
+ currency = forms.ChoiceField(
420
+ choices=CurrencyChoices, required=False, label=_('Currency')
368
421
  )
369
- currency = forms.ChoiceField(choices=CurrencyChoices, required=False)
370
422
  contracts = DynamicModelMultipleChoiceField(
371
- queryset=Contract.objects.all(), required=False
423
+ queryset=Contract.objects.all(),
424
+ required=False,
425
+ selector=True,
426
+ label=_('Contracts'),
372
427
  )
373
428
  tag = TagFilterField(model)
374
429
 
@@ -378,6 +433,7 @@ class InvoiceCSVForm(NetBoxModelImportForm):
378
433
  queryset=Contract.objects.all(),
379
434
  to_field_name='name',
380
435
  help_text='Related Contracts',
436
+ label=_('Contracts'),
381
437
  )
382
438
 
383
439
  class Meta:
@@ -399,19 +455,52 @@ class InvoiceCSVForm(NetBoxModelImportForm):
399
455
 
400
456
 
401
457
  class InvoiceBulkEditForm(NetBoxModelBulkEditForm):
402
- number = forms.CharField(max_length=100, required=True)
403
- template = forms.BooleanField(required=False)
404
- date = forms.DateField(required=False)
458
+ number = forms.CharField(max_length=100, required=True, label=_('Number'))
459
+ template = forms.BooleanField(
460
+ required=False,
461
+ label=_('Template'),
462
+ help_text=_('Wether this invoice is a template or not'),
463
+ )
464
+ date = forms.DateField(
465
+ required=False,
466
+ label=_('Date'),
467
+ )
405
468
  contracts = DynamicModelMultipleChoiceField(
406
- queryset=Contract.objects.all(), required=False
407
- )
408
- period_start = forms.DateField(required=False)
409
- period_end = forms.DateField(required=False)
410
- currency = forms.ChoiceField(choices=CurrencyChoices, required=False)
411
- accounting_dimensions = Dimensions(required=False)
412
- amount = forms.DecimalField(max_digits=10, decimal_places=2, required=False)
413
- documents = forms.URLField(required=False)
414
- comments = CommentField()
469
+ queryset=Contract.objects.all(),
470
+ required=False,
471
+ selector=True,
472
+ )
473
+ period_start = forms.DateField(
474
+ required=False,
475
+ label=_('Period start'),
476
+ )
477
+ period_end = forms.DateField(
478
+ required=False,
479
+ label=_('Period end'),
480
+ )
481
+ currency = forms.ChoiceField(
482
+ choices=CurrencyChoices,
483
+ required=False,
484
+ label=_('Currency'),
485
+ )
486
+ accounting_dimensions = Dimensions(
487
+ required=False,
488
+ label=_('Accounting dimensions'),
489
+ )
490
+ amount = forms.DecimalField(
491
+ max_digits=10,
492
+ decimal_places=2,
493
+ required=False,
494
+ label=_('Amount'),
495
+ )
496
+ documents = forms.URLField(
497
+ required=False,
498
+ label=_('Documents'),
499
+ help_text=_('URL to the contract documents'),
500
+ )
501
+ comments = CommentField(
502
+ label=_('Comments'),
503
+ )
415
504
  nullable_fields = (
416
505
  'accounting_dimensions',
417
506
  'comments',
@@ -424,23 +513,23 @@ class InvoiceBulkEditForm(NetBoxModelBulkEditForm):
424
513
 
425
514
 
426
515
  class ServiceProviderForm(NetBoxModelForm):
427
- slug = SlugField()
428
- comments = CommentField()
516
+ slug = SlugField(label=_('Slug'))
517
+ comments = CommentField(label=_('Comments'))
429
518
 
430
519
  class Meta:
431
520
  model = ServiceProvider
432
521
  fields = ('name', 'slug', 'portal_url', 'comments', 'tags')
433
522
 
434
523
 
435
- class ServiceProviderFilterSetForm(NetBoxModelFilterSetForm):
524
+ class ServiceProviderFilterForm(NetBoxModelFilterSetForm):
436
525
  model = ServiceProvider
437
- name = forms.CharField(required=False)
526
+ name = forms.CharField(required=False, label=_('Name'))
438
527
  tag = TagFilterField(model)
439
528
 
440
529
 
441
530
  class ServiceProviderCSVForm(NetBoxModelImportForm):
442
- slug = SlugField()
443
- comments = CommentField()
531
+ slug = SlugField(label=_('Slug'))
532
+ comments = CommentField(label=_('Comments'))
444
533
 
445
534
  class Meta:
446
535
  model = ServiceProvider
@@ -448,8 +537,8 @@ class ServiceProviderCSVForm(NetBoxModelImportForm):
448
537
 
449
538
 
450
539
  class ServiceProviderBulkEditForm(NetBoxModelBulkEditForm):
451
- name = forms.CharField(max_length=100, required=True)
452
- comments = CommentField()
540
+ name = forms.CharField(max_length=100, required=True, label=_('Name'))
541
+ comments = CommentField(label=_('Comments'))
453
542
  nullable_fields = ('comments',)
454
543
  model = ServiceProvider
455
544
 
@@ -458,7 +547,9 @@ class ServiceProviderBulkEditForm(NetBoxModelBulkEditForm):
458
547
 
459
548
 
460
549
  class ContractAssignmentForm(NetBoxModelForm):
461
- contract = DynamicModelChoiceField(queryset=Contract.objects.all())
550
+ contract = DynamicModelChoiceField(
551
+ queryset=Contract.objects.all(), selector=True, label=_('Contract')
552
+ )
462
553
 
463
554
  class Meta:
464
555
  model = ContractAssignment
@@ -469,18 +560,25 @@ class ContractAssignmentForm(NetBoxModelForm):
469
560
  }
470
561
 
471
562
 
472
- class ContractAssignmentFilterSetForm(NetBoxModelFilterSetForm):
563
+ class ContractAssignmentFilterForm(NetBoxModelFilterSetForm):
473
564
  model = ContractAssignment
474
- contract = DynamicModelChoiceField(queryset=Contract.objects.all())
565
+ contract = DynamicModelChoiceField(
566
+ queryset=Contract.objects.all(),
567
+ selector=True,
568
+ label=_('Contract'),
569
+ )
475
570
 
476
571
 
477
572
  class ContractAssignmentImportForm(NetBoxModelImportForm):
478
573
  content_type = CSVContentTypeField(
479
574
  queryset=ContentType.objects.all(),
480
575
  help_text='Content Type in the form <app>.<model>',
576
+ label=_('Content type'),
481
577
  )
482
578
  contract = CSVModelChoiceField(
483
- queryset=Contract.objects.all(), help_text='Contract id'
579
+ queryset=Contract.objects.all(),
580
+ help_text='Contract id',
581
+ label=_('Contract'),
484
582
  )
485
583
 
486
584
  class Meta:
@@ -492,9 +590,16 @@ class ContractAssignmentImportForm(NetBoxModelImportForm):
492
590
 
493
591
 
494
592
  class InvoiceLineForm(NetBoxModelForm):
495
- invoice = DynamicModelChoiceField(queryset=Invoice.objects.all())
593
+ invoice = DynamicModelChoiceField(
594
+ queryset=Invoice.objects.all(),
595
+ selector=True,
596
+ label=_('Invoice'),
597
+ )
496
598
  accounting_dimensions = DynamicModelMultipleChoiceField(
497
- queryset=AccountingDimension.objects.all(), required=False
599
+ queryset=AccountingDimension.objects.all(),
600
+ required=False,
601
+ selector=True,
602
+ label=_('Accounting dimensions'),
498
603
  )
499
604
 
500
605
  def clean(self):
@@ -527,13 +632,25 @@ class InvoiceLineForm(NetBoxModelForm):
527
632
  ]
528
633
 
529
634
 
530
- class InvoiceLineFilterSetForm(NetBoxModelFilterSetForm):
635
+ class InvoiceLineFilterForm(NetBoxModelFilterSetForm):
531
636
  model = InvoiceLine
532
- invoice = DynamicModelChoiceField(queryset=Invoice.objects.all(), required=False)
637
+ invoice = DynamicModelChoiceField(
638
+ queryset=Invoice.objects.all(),
639
+ required=False,
640
+ selector=True,
641
+ label=_('Invoice'),
642
+ )
533
643
  accounting_dimensions = DynamicModelMultipleChoiceField(
534
- queryset=AccountingDimension.objects.all(), required=False
644
+ queryset=AccountingDimension.objects.all(),
645
+ required=False,
646
+ selector=True,
647
+ label=_('Accounting dimensions'),
648
+ )
649
+ currency = forms.ChoiceField(
650
+ choices=CurrencyChoices,
651
+ required=False,
652
+ label=_('Currency'),
535
653
  )
536
- currency = forms.ChoiceField(choices=CurrencyChoices, required=False)
537
654
  tag = TagFilterField(model)
538
655
 
539
656
 
@@ -542,11 +659,13 @@ class InvoiceLineImportForm(NetBoxModelImportForm):
542
659
  queryset=Invoice.objects.all(),
543
660
  to_field_name='number',
544
661
  help_text='Invoice number',
662
+ label=_('Invoice'),
545
663
  )
546
664
  accounting_dimensions = CSVModelMultipleChoiceField(
547
665
  queryset=AccountingDimension.objects.all(),
548
666
  to_field_name='id',
549
667
  help_text='accounting dimension id',
668
+ label=_('Accounting dimensions'),
550
669
  )
551
670
 
552
671
  class Meta:
@@ -564,7 +683,10 @@ class InvoiceLineImportForm(NetBoxModelImportForm):
564
683
  class InvoiceLineBulkEditForm(NetBoxModelBulkEditForm):
565
684
  invoice = DynamicModelChoiceField(queryset=Invoice.objects.all(), required=False)
566
685
  accounting_dimensions = DynamicModelMultipleChoiceField(
567
- queryset=AccountingDimension.objects.all(), required=False
686
+ queryset=AccountingDimension.objects.all(),
687
+ required=False,
688
+ selector=True,
689
+ label=_('Accounting dimensions'),
568
690
  )
569
691
  model = InvoiceLine
570
692
 
@@ -584,12 +706,16 @@ class AccountingDimensionForm(NetBoxModelForm):
584
706
  ]
585
707
 
586
708
 
587
- class AccountingDimensionFilterSetForm(NetBoxModelFilterSetForm):
709
+ class AccountingDimensionFilterForm(NetBoxModelFilterSetForm):
588
710
  model = AccountingDimension
589
711
 
590
- name = forms.CharField(required=False)
591
- value = forms.CharField(required=False)
592
- status = forms.ChoiceField(choices=AccountingDimensionStatusChoices, required=False)
712
+ name = forms.CharField(required=False, label=_('Name'))
713
+ value = forms.CharField(required=False, label=_('Value'))
714
+ status = forms.ChoiceField(
715
+ choices=AccountingDimensionStatusChoices,
716
+ required=False,
717
+ label=_('Status'),
718
+ )
593
719
 
594
720
 
595
721
  class AccountingDimensionImportForm(NetBoxModelImportForm):
@@ -607,6 +733,6 @@ class AccountingDimensionImportForm(NetBoxModelImportForm):
607
733
 
608
734
 
609
735
  class AccountingDimensionBulkEditForm(NetBoxModelBulkEditForm):
610
- name = forms.CharField(max_length=20, required=False)
611
- value = forms.CharField(max_length=20, required=False)
736
+ name = forms.CharField(max_length=20, required=False, label=_('Name'))
737
+ value = forms.CharField(max_length=20, required=False, label=_('Value'))
612
738
  model = AccountingDimension
@@ -0,0 +1,32 @@
1
+ # Generated by Django 5.0.10 on 2025-01-03 19:52
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+ dependencies = [
8
+ ('netbox_contract', '0036_alter_invoiceline_accounting_dimensions'),
9
+ ]
10
+
11
+ operations = [
12
+ migrations.AddField(
13
+ model_name='contract',
14
+ name='notice_period',
15
+ field=models.IntegerField(default=90),
16
+ ),
17
+ migrations.AlterField(
18
+ model_name='contract',
19
+ name='currency',
20
+ field=models.CharField(default='eur', max_length=3),
21
+ ),
22
+ migrations.AlterField(
23
+ model_name='invoice',
24
+ name='currency',
25
+ field=models.CharField(default='eur', max_length=3),
26
+ ),
27
+ migrations.AlterField(
28
+ model_name='invoiceline',
29
+ name='currency',
30
+ field=models.CharField(default='eur', max_length=3),
31
+ ),
32
+ ]