constec 0.2.1__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {constec-0.2.1 → constec-0.3.0}/PKG-INFO +1 -1
- {constec-0.2.1 → constec-0.3.0}/constec/db/migrations/0001_initial.py +7 -2
- {constec-0.2.1 → constec-0.3.0}/constec/db/models/company.py +1 -0
- {constec-0.2.1 → constec-0.3.0}/constec/db/models/erp_entity.py +17 -2
- {constec-0.2.1 → constec-0.3.0}/constec/db/models/tag.py +2 -0
- {constec-0.2.1 → constec-0.3.0}/constec/db/models/user.py +2 -0
- {constec-0.2.1 → constec-0.3.0}/constec.egg-info/PKG-INFO +1 -1
- {constec-0.2.1 → constec-0.3.0}/pyproject.toml +1 -1
- {constec-0.2.1 → constec-0.3.0}/LICENSE +0 -0
- {constec-0.2.1 → constec-0.3.0}/README.md +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/db/__init__.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/db/apps.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/db/migrations/__init__.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/db/models/__init__.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/db/models/base.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/db/models/contact.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/db/models/erp.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/db/models/flow.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/db/models/group.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/db/models/module.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/db/models/organization.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/db/models/person.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/db/models/session.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/py.typed +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/services/__init__.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/services/encryption.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/shared/__init__.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/shared/exceptions.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/utils/__init__.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/utils/cuit.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec/utils/password.py +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec.egg-info/SOURCES.txt +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec.egg-info/dependency_links.txt +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec.egg-info/requires.txt +0 -0
- {constec-0.2.1 → constec-0.3.0}/constec.egg-info/top_level.txt +0 -0
- {constec-0.2.1 → constec-0.3.0}/setup.cfg +0 -0
|
@@ -236,6 +236,11 @@ class Migration(migrations.Migration):
|
|
|
236
236
|
'db_table': 'core"."persons',
|
|
237
237
|
},
|
|
238
238
|
),
|
|
239
|
+
migrations.AddField(
|
|
240
|
+
model_name='entity',
|
|
241
|
+
name='company',
|
|
242
|
+
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='erp_entities', to='constec_db.company'),
|
|
243
|
+
),
|
|
239
244
|
migrations.AddField(
|
|
240
245
|
model_name='entity',
|
|
241
246
|
name='person',
|
|
@@ -498,11 +503,11 @@ class Migration(migrations.Migration):
|
|
|
498
503
|
),
|
|
499
504
|
migrations.AddIndex(
|
|
500
505
|
model_name='entity',
|
|
501
|
-
index=models.Index(fields=['
|
|
506
|
+
index=models.Index(fields=['company', 'cuit'], name='entities_company_cuit_idx'),
|
|
502
507
|
),
|
|
503
508
|
migrations.AlterUniqueTogether(
|
|
504
509
|
name='entity',
|
|
505
|
-
unique_together={('
|
|
510
|
+
unique_together={('company', 'role', 'external_id')},
|
|
506
511
|
),
|
|
507
512
|
migrations.AlterUniqueTogether(
|
|
508
513
|
name='connection',
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
from django.core.exceptions import ValidationError
|
|
1
2
|
from django.db import models
|
|
2
3
|
from .base import UUIDModel
|
|
4
|
+
from .company import Company
|
|
3
5
|
from .erp import System
|
|
4
6
|
from .person import Person
|
|
5
7
|
|
|
@@ -30,6 +32,11 @@ class Entity(UUIDModel):
|
|
|
30
32
|
but no Core account yet). When they authenticate via CUIT, we can
|
|
31
33
|
optionally link them to a Person later.
|
|
32
34
|
"""
|
|
35
|
+
company = models.ForeignKey(
|
|
36
|
+
Company,
|
|
37
|
+
on_delete=models.CASCADE,
|
|
38
|
+
related_name="erp_entities",
|
|
39
|
+
)
|
|
33
40
|
person = models.ForeignKey(
|
|
34
41
|
Person,
|
|
35
42
|
on_delete=models.CASCADE,
|
|
@@ -63,12 +70,20 @@ class Entity(UUIDModel):
|
|
|
63
70
|
class Meta:
|
|
64
71
|
app_label = 'constec_db'
|
|
65
72
|
db_table = '"erp"."entities"'
|
|
66
|
-
|
|
73
|
+
verbose_name_plural = 'Entities'
|
|
74
|
+
unique_together = [['company', 'role', 'external_id']]
|
|
67
75
|
indexes = [
|
|
68
76
|
models.Index(fields=['cuit']),
|
|
69
|
-
models.Index(fields=['
|
|
77
|
+
models.Index(fields=['company', 'cuit']),
|
|
70
78
|
]
|
|
71
79
|
|
|
80
|
+
def clean(self):
|
|
81
|
+
from .erp import CompanySystem
|
|
82
|
+
if not CompanySystem.objects.filter(company=self.company, system=self.system).exists():
|
|
83
|
+
raise ValidationError(
|
|
84
|
+
f"Company {self.company} is not associated with System {self.system}"
|
|
85
|
+
)
|
|
86
|
+
|
|
72
87
|
def __str__(self):
|
|
73
88
|
person_info = f"({self.person.full_name})" if self.person else "(no person linked)"
|
|
74
89
|
return f"[{self.system.name}] {self.role.name} {self.external_id} {person_info}"
|
|
@@ -66,6 +66,8 @@ class UserCompanyAccess(UUIDModel):
|
|
|
66
66
|
class Meta:
|
|
67
67
|
app_label = 'constec_db'
|
|
68
68
|
db_table = 'core"."user_company_access'
|
|
69
|
+
verbose_name = 'User company access'
|
|
70
|
+
verbose_name_plural = 'User company access'
|
|
69
71
|
unique_together = [['user', 'company']]
|
|
70
72
|
|
|
71
73
|
def __str__(self):
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "constec"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.3.0"
|
|
8
8
|
description = "Base library for the Constec ecosystem - shared utilities, models, and namespace foundation"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|