netbox-contract 2.3.0__tar.gz → 2.3.2__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/CONTRIBUTING.md +148 -0
- netbox_contract-2.3.2/MANIFEST.in +13 -0
- {netbox_contract-2.3.0/src/netbox_contract.egg-info → netbox_contract-2.3.2}/PKG-INFO +28 -19
- {netbox_contract-2.3.0 → netbox_contract-2.3.2}/README.md +27 -18
- netbox_contract-2.3.2/docs/img/accounting_dimensions.png +0 -0
- netbox_contract-2.3.2/docs/img/contract.png +0 -0
- netbox_contract-2.3.2/docs/img/contract_linked_objects.png +0 -0
- netbox_contract-2.3.2/docs/img/invoice.png +0 -0
- netbox_contract-2.3.2/docs/img/invoice_line.png +0 -0
- netbox_contract-2.3.2/docs/img/invoice_linked_objects.png +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/__init__.py +2 -2
- netbox_contract-2.3.2/netbox_contract/constants.py +13 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/forms.py +61 -88
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0019_auto_20230924_1813.py +1 -1
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0026_auto_20240421_1550.py +1 -1
- netbox_contract-2.3.2/netbox_contract/migrations/0040_alter_contract_currency_alter_invoice_currency_and_more.py +28 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/models.py +30 -42
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/tables.py +21 -6
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/templates/netbox_contract/contract.html +3 -3
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/templates/netbox_contract/contractassignment.html +1 -1
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/templates/netbox_contract/invoice.html +1 -1
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/templates/netbox_contract/invoiceline.html +1 -1
- netbox_contract-2.3.2/netbox_contract/tests/__init__.py +1 -0
- netbox_contract-2.3.2/netbox_contract/tests/custom.py +18 -0
- netbox_contract-2.3.2/netbox_contract/tests/test_views.py +449 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/urls.py +16 -6
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/views.py +20 -6
- {netbox_contract-2.3.0 → netbox_contract-2.3.2/netbox_contract.egg-info}/PKG-INFO +28 -19
- netbox_contract-2.3.2/netbox_contract.egg-info/SOURCES.txt +84 -0
- {netbox_contract-2.3.0 → netbox_contract-2.3.2}/pyproject.toml +8 -19
- netbox_contract-2.3.0/MANIFEST.in +0 -2
- netbox_contract-2.3.0/src/netbox_contract/constants.py +0 -6
- netbox_contract-2.3.0/src/netbox_contract.egg-info/SOURCES.txt +0 -74
- netbox_contract-2.3.0/src/netbox_contract.egg-info/not-zip-safe +0 -1
- {netbox_contract-2.3.0 → netbox_contract-2.3.2}/LICENSE +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/api/__init__.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/api/serializers.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/api/urls.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/api/views.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/filtersets.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0001_initial.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0002_alter_contract_circuit_and_more.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0003_alter_contract_custom_field_data_and_more.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0004_contract_currency_invoice_currency.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0005_contract_accounting_dimensions_and_more.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0006_alter_contract_circuit.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0007_invoice_date.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0008_invoice_comments.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0009_contract_external_reference.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0010_invoice_contracts.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0011_auto_20230122_2112.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0012_remove_invoice_contract.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0013_contract_documents_invoice_documents.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0014_contract_end_date.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0015_contractassignement.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0016_contract_parent.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0017_alter_contract_accounting_dimensions.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0018_contract_external_partie_object_id_and_more.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0020_alter_contract_external_partie.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0021_alter_contract_external_partie.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0022_alter_contract_internal_partie_alter_contract_parent.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0023_rename_contractassignement_contractassignment_and_more.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0024_remove_contract_external_partie.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0025_remove_contract_circuit_and_more.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0027_invoiceline.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0028_invoiceline_accounting_dimensions.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0029_remove_invoiceline_accounting_dimensions_and_more.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0030_alter_invoiceline_accounting_dimensions.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0031_contract_invoice_template_invoice_template.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0032_alter_invoice_period_end_alter_invoice_period_start_and_more.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0033_remove_contract_invoice_template.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0034_contract_yrc_alter_contract_mrc.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0035_accountingdimension_status_and_more.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0036_alter_invoiceline_accounting_dimensions.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0037_contract_notice_period_alter_contract_currency_and_more.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0038_alter_accountingdimension_options_and_more.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/0039_alter_accountingdimension_status_and_more.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/migrations/__init__.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/navigation.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/search.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/template_content.py +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/templates/contract_assignments_bottom.html +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/templates/contract_list_bottom.html +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/templates/netbox_contract/accountingdimension.html +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract/templates/netbox_contract/serviceprovider.html +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract.egg-info/dependency_links.txt +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract.egg-info/requires.txt +0 -0
- {netbox_contract-2.3.0/src → netbox_contract-2.3.2}/netbox_contract.egg-info/top_level.txt +0 -0
- {netbox_contract-2.3.0 → netbox_contract-2.3.2}/setup.cfg +0 -0
- {netbox_contract-2.3.0 → netbox_contract-2.3.2}/setup.py +0 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Contributions are welcome!
|
|
4
|
+
|
|
5
|
+
## Types of contributions
|
|
6
|
+
|
|
7
|
+
### Report bugs or submit feedback
|
|
8
|
+
|
|
9
|
+
Report bugs and submit feetback [here](https://github.com/mlebreuil/netbox-contract/issues).
|
|
10
|
+
|
|
11
|
+
### Fix bugs
|
|
12
|
+
|
|
13
|
+
Look through the GitHub issues for bugs. Anything tagged with "bug" and "help
|
|
14
|
+
wanted" is open to whoever wants to implement it.
|
|
15
|
+
|
|
16
|
+
### Implement features
|
|
17
|
+
|
|
18
|
+
Look through the GitHub issues for features. Anything tagged with "enhancement"
|
|
19
|
+
and "help wanted" is open to whoever wants to implement it.
|
|
20
|
+
|
|
21
|
+
## Coding conventions
|
|
22
|
+
|
|
23
|
+
Netbox [Style Guide](https://netboxlabs.com/docs/netbox/en/stable/development/style-guide/)
|
|
24
|
+
Django [Coding style](https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/coding-style/)
|
|
25
|
+
|
|
26
|
+
## linting
|
|
27
|
+
|
|
28
|
+
The [ruff](https://docs.astral.sh/ruff/) linter is used to enforce code style. A [pre-commit hook](./getting-started.md#3-enable-pre-commit-hooks) which runs this automatically is included with NetBox. To invoke `ruff` manually, run:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
python3 -m pip install ruff
|
|
32
|
+
ruff check netbox_contract/
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
The pre-commit Python framework is used to simplify the managment of pre-commit hooks.
|
|
37
|
+
Config is stored in .pre-commit-config.yaml
|
|
38
|
+
|
|
39
|
+
## Repository structure
|
|
40
|
+
|
|
41
|
+
There are 2 permanent branch in the repository:
|
|
42
|
+
|
|
43
|
+
* master - The current stable release. Individual changes should never be pushed directly to this branch, but rather merged from develop.
|
|
44
|
+
* develop - Active development for the upcoming patch release. Pull requests will typically be based on this branch unless they introduce breaking changes that must be deferred until the next minor release.
|
|
45
|
+
|
|
46
|
+
For each new feature or bug fix a branch is created from the corresponding issue.
|
|
47
|
+
|
|
48
|
+
## Setup your development environment
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
1. [Install Netbox](https://github.com/netbox-community/netbox/blob/develop/docs/installation/).
|
|
52
|
+
Make sure taht at the Netbox installtion step you follow the "Option B: Clone the Git Repository"
|
|
53
|
+
|
|
54
|
+
2. From the Netbox directory you activate the NetBox virtual environment
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
$ cd netbox
|
|
58
|
+
$ source venv/netbox/bin/activate
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
3. Fork the [netbox-contract](https://github.com/mlebreuil/netbox-contract/) repo on GitHub.
|
|
62
|
+
4. Clone your fork locally
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
$ cd ..
|
|
66
|
+
$ git clone git@github.com:your_name_here/netbox-contract.git
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
5. Add the plugin to NetBox virtual environment:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
$ cd netbox-contract
|
|
73
|
+
$ python3 -m pip install -e .
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
6. install pre-commit:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
python -m pip install pre-commit
|
|
80
|
+
pre-commit install
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
6. Update the Netbox configuration and run the database migrations as mentionned in the plugin installation steps.
|
|
84
|
+
|
|
85
|
+
7. Create a branch for local development:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
$ git checkout -b name-of-your-bugfix-or-feature
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Make your changes locally.
|
|
92
|
+
|
|
93
|
+
8. You can test your changes using the django development server:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
$ python3 netbox/netbox/manage.py runserver 0.0.0.0:8000 --insecure
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Connect to the name or IP of the server (as defined in ALLOWED_HOSTS) on port 8000; for example, http://127.0.0.1:8000/.
|
|
100
|
+
|
|
101
|
+
9. Run unittest
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
$ python3 netbox/netbox/manage.py test netbox_contract
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
10. Commit your changes and push your branch to GitHub:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
$ git add .
|
|
111
|
+
$ git commit -m "Your detailed description of your changes."
|
|
112
|
+
$ git push origin name-of-your-bugfix-or-feature
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
1. Submit a pull request through the GitHub website.
|
|
116
|
+
|
|
117
|
+
## Model changes
|
|
118
|
+
|
|
119
|
+
Create the migrations:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
source netbox/venv/bin/activate
|
|
123
|
+
python3 netbox/netbox/manage.py makemigrations netbox_contract --dry-run
|
|
124
|
+
python3 netbox/netbox/manage.py makemigrations netbox_contract
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Apply the migrations:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
source netbox/venv/bin/activate
|
|
131
|
+
python3 netbox/netbox/manage.py migrate
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Pull Request Guidelines
|
|
135
|
+
|
|
136
|
+
Before you submit a pull request, check that it meets these guidelines:
|
|
137
|
+
|
|
138
|
+
1. The pull request should include tests.
|
|
139
|
+
2. If the pull request adds functionality, the docs should be updated.
|
|
140
|
+
3. The pull request should work for Python 3.10 and 3.11. Check [Actions](https://github.com/mlebreuil/netbox-contract/actions)
|
|
141
|
+
and make sure that the tests pass for all supported Python versions.
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
## Deploying
|
|
145
|
+
|
|
146
|
+
A reminder for the maintainers on how to deploy.
|
|
147
|
+
Make sure all your changes are committed (including an entry in CHANGELOG.md) and that all tests pass.
|
|
148
|
+
Then in the github project go to `Releases` and create a new release with a new tag. This will automatically upload the release to pypi:
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
include CONTRIBUTING.md
|
|
2
|
+
include LICENSE
|
|
3
|
+
include README.md
|
|
4
|
+
|
|
5
|
+
recursive-include tests *
|
|
6
|
+
recursive-exclude * __pycache__
|
|
7
|
+
recursive-exclude * *.py[co]
|
|
8
|
+
|
|
9
|
+
recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
graft netbox_contract/templates
|
|
13
|
+
graft netbox_contract/templates/netbox_contract
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: netbox-contract
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.2
|
|
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
|
|
@@ -14,15 +14,30 @@ License-File: LICENSE
|
|
|
14
14
|
Requires-Dist: python-dateutil
|
|
15
15
|
Requires-Dist: drf_yasg
|
|
16
16
|
|
|
17
|
-
# Contract
|
|
18
|
-
## Overview
|
|
19
|
-
The pluggin adds contracts and invoices model to Netbox.
|
|
20
|
-
It allows to register contract with objects.
|
|
21
|
-
Add invoices to contracts.
|
|
17
|
+
# Contract plugin
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
NetBox plugin to manage contracts.
|
|
24
20
|
|
|
25
|
-
|
|
21
|
+
|
|
22
|
+
* Free software: MIT
|
|
23
|
+
* Documentation: https://mlebreuil.github.io/netbox-contract/
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
|
|
27
|
+
The plugin adds contracts and invoices model to NetBox.
|
|
28
|
+
It allows to link contract with objects.
|
|
29
|
+
And link invoice templates and invoices with contracts.
|
|
30
|
+
Invoice lines can be linked to each invoice / invoice template.
|
|
31
|
+
Accounting dimensions can be linked with invoice lines.
|
|
32
|
+
|
|
33
|
+
## Compatibility
|
|
34
|
+
|
|
35
|
+
| NetBox Version | Plugin Version |
|
|
36
|
+
|----------------|----------------|
|
|
37
|
+
| 4.1 | 2.2 |
|
|
38
|
+
| 4.2 | 2.3 |
|
|
39
|
+
|
|
40
|
+
## Installing
|
|
26
41
|
|
|
27
42
|
### Activate venv
|
|
28
43
|
To ensure our plugin is accessible to the NetBox installation, we first need to activate the Python [virtual environment](https://docs.python.org/3/library/venv.html) that was created when we installed NetBox. To do this, determine the virtual environment's path (this will be `/opt/netbox/venv/` if you use the documentation's defaults) and activate it:
|
|
@@ -39,7 +54,7 @@ $ python3 -m pip install netbox-contract
|
|
|
39
54
|
|
|
40
55
|
### Configure NetBox
|
|
41
56
|
|
|
42
|
-
Finally, we need to configure NetBox to enable our new plugin.
|
|
57
|
+
Finally, we need to configure NetBox to enable our new plugin. In the NetBox installation directory, open `netbox/netbox/configuration.py` and locate the `PLUGINS` parameter; it should be an empty list. (If it's not yet defined, go ahead and create it.) Add the name of our plugin to this list:
|
|
43
58
|
|
|
44
59
|
```python
|
|
45
60
|
# configuration.py
|
|
@@ -50,18 +65,13 @@ PLUGINS = [
|
|
|
50
65
|
|
|
51
66
|
### Customize the plugin
|
|
52
67
|
|
|
53
|
-
The following
|
|
68
|
+
The following configuration items can be set:
|
|
54
69
|
|
|
55
70
|
```python
|
|
56
71
|
# configuration.py
|
|
57
72
|
PLUGINS_CONFIG = {
|
|
58
73
|
'netbox_contract': {
|
|
59
74
|
'top_level_menu': True,
|
|
60
|
-
'default_accounting_dimensions':{
|
|
61
|
-
"account": "",
|
|
62
|
-
"project": "",
|
|
63
|
-
"cost center": ""
|
|
64
|
-
},
|
|
65
75
|
'mandatory_contract_fields': [],
|
|
66
76
|
'hidden_contract_fields': [],
|
|
67
77
|
'mandatory_invoice_fields': [],
|
|
@@ -86,12 +96,11 @@ The first currency will also be the default currency for contracts.
|
|
|
86
96
|
# configuration.py
|
|
87
97
|
FIELD_CHOICES = {
|
|
88
98
|
'netbox_contract.Contract.internal_partie': (
|
|
89
|
-
('
|
|
90
|
-
('
|
|
91
|
-
('Nagra India', 'Nagra India', 'green'),
|
|
99
|
+
('entity1', 'Entity 1', 'green'),
|
|
100
|
+
('entity2', 'Entity 2', 'yellow'),
|
|
92
101
|
),
|
|
93
102
|
'netbox_contract.Contract.currency': (
|
|
94
|
-
('usd', 'USD'),
|
|
103
|
+
('usd', 'USD'), # 1st position is the default currency
|
|
95
104
|
('eur', 'EUR'),
|
|
96
105
|
('chf', 'CHF'),
|
|
97
106
|
('pln', 'PLN'),
|
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
# Contract
|
|
2
|
-
## Overview
|
|
3
|
-
The pluggin adds contracts and invoices model to Netbox.
|
|
4
|
-
It allows to register contract with objects.
|
|
5
|
-
Add invoices to contracts.
|
|
1
|
+
# Contract plugin
|
|
6
2
|
|
|
7
|
-
|
|
3
|
+
NetBox plugin to manage contracts.
|
|
8
4
|
|
|
9
|
-
|
|
5
|
+
|
|
6
|
+
* Free software: MIT
|
|
7
|
+
* Documentation: https://mlebreuil.github.io/netbox-contract/
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
The plugin adds contracts and invoices model to NetBox.
|
|
12
|
+
It allows to link contract with objects.
|
|
13
|
+
And link invoice templates and invoices with contracts.
|
|
14
|
+
Invoice lines can be linked to each invoice / invoice template.
|
|
15
|
+
Accounting dimensions can be linked with invoice lines.
|
|
16
|
+
|
|
17
|
+
## Compatibility
|
|
18
|
+
|
|
19
|
+
| NetBox Version | Plugin Version |
|
|
20
|
+
|----------------|----------------|
|
|
21
|
+
| 4.1 | 2.2 |
|
|
22
|
+
| 4.2 | 2.3 |
|
|
23
|
+
|
|
24
|
+
## Installing
|
|
10
25
|
|
|
11
26
|
### Activate venv
|
|
12
27
|
To ensure our plugin is accessible to the NetBox installation, we first need to activate the Python [virtual environment](https://docs.python.org/3/library/venv.html) that was created when we installed NetBox. To do this, determine the virtual environment's path (this will be `/opt/netbox/venv/` if you use the documentation's defaults) and activate it:
|
|
@@ -23,7 +38,7 @@ $ python3 -m pip install netbox-contract
|
|
|
23
38
|
|
|
24
39
|
### Configure NetBox
|
|
25
40
|
|
|
26
|
-
Finally, we need to configure NetBox to enable our new plugin.
|
|
41
|
+
Finally, we need to configure NetBox to enable our new plugin. In the NetBox installation directory, open `netbox/netbox/configuration.py` and locate the `PLUGINS` parameter; it should be an empty list. (If it's not yet defined, go ahead and create it.) Add the name of our plugin to this list:
|
|
27
42
|
|
|
28
43
|
```python
|
|
29
44
|
# configuration.py
|
|
@@ -34,18 +49,13 @@ PLUGINS = [
|
|
|
34
49
|
|
|
35
50
|
### Customize the plugin
|
|
36
51
|
|
|
37
|
-
The following
|
|
52
|
+
The following configuration items can be set:
|
|
38
53
|
|
|
39
54
|
```python
|
|
40
55
|
# configuration.py
|
|
41
56
|
PLUGINS_CONFIG = {
|
|
42
57
|
'netbox_contract': {
|
|
43
58
|
'top_level_menu': True,
|
|
44
|
-
'default_accounting_dimensions':{
|
|
45
|
-
"account": "",
|
|
46
|
-
"project": "",
|
|
47
|
-
"cost center": ""
|
|
48
|
-
},
|
|
49
59
|
'mandatory_contract_fields': [],
|
|
50
60
|
'hidden_contract_fields': [],
|
|
51
61
|
'mandatory_invoice_fields': [],
|
|
@@ -70,12 +80,11 @@ The first currency will also be the default currency for contracts.
|
|
|
70
80
|
# configuration.py
|
|
71
81
|
FIELD_CHOICES = {
|
|
72
82
|
'netbox_contract.Contract.internal_partie': (
|
|
73
|
-
('
|
|
74
|
-
('
|
|
75
|
-
('Nagra India', 'Nagra India', 'green'),
|
|
83
|
+
('entity1', 'Entity 1', 'green'),
|
|
84
|
+
('entity2', 'Entity 2', 'yellow'),
|
|
76
85
|
),
|
|
77
86
|
'netbox_contract.Contract.currency': (
|
|
78
|
-
('usd', 'USD'),
|
|
87
|
+
('usd', 'USD'), # 1st position is the default currency
|
|
79
88
|
('eur', 'EUR'),
|
|
80
89
|
('chf', 'CHF'),
|
|
81
90
|
('pln', 'PLN'),
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -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.3.
|
|
8
|
+
version = '2.3.2'
|
|
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.2.0'
|
|
13
13
|
required_settings = []
|
|
14
14
|
default_settings = {
|
|
15
15
|
'top_level_menu': False,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from django.db.models import Q
|
|
2
|
+
|
|
3
|
+
SERVICE_PROVIDER_MODELS = Q(
|
|
4
|
+
Q(app_label='circuits', model__in=('provider',))
|
|
5
|
+
| Q(app_label='netbox_contract', model__in=('serviceprovider',))
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
ASSIGNEMENT_MODELS = Q(
|
|
9
|
+
Q(app_label='circuits', model__in=('circuit',))
|
|
10
|
+
| Q(app_label='dcim', model__in=('site',))
|
|
11
|
+
| Q(app_label='dcim', model__in=('device',))
|
|
12
|
+
| Q(app_label='virtualization', model__in=('virtualmachine',))
|
|
13
|
+
)
|