diff --git a/app/access/models/__init__.py b/app/access/models/__init__.py index c24760f8..de76019a 100644 --- a/app/access/models/__init__.py +++ b/app/access/models/__init__.py @@ -1,3 +1,4 @@ from . import contact +from . import company_base from . import person from . import role diff --git a/app/access/models/company_base.py b/app/access/models/company_base.py new file mode 100644 index 00000000..93a59ee3 --- /dev/null +++ b/app/access/models/company_base.py @@ -0,0 +1,102 @@ +from django.db import models + +from access.models.entity import Entity + + + +class Company( + Entity +): +# This model is intended to be called `Organization`, however at the time of +# creation this was not possible as Tenant (ne Organization) still has +# references in code to `organization` witch clashes with the intended name of +# this model. + + + class Meta: + + ordering = [ + 'name', + ] + + sub_model_type = 'company' + + verbose_name = 'Company' + + verbose_name_plural = 'Companies' + + + name = models.CharField( + blank = False, + help_text = 'The name of this entity', + max_length = 80, + unique = False, + verbose_name = 'Name' + ) + + + def __str__(self) -> str: + + return self.name + + + documentation = '' + + history_model_name = 'company' + + page_layout: dict = [ + { + "name": "Details", + "slug": "details", + "sections": [ + { + "layout": "double", + "left": [ + 'organization', + 'name', + ], + "right": [ + 'model_notes', + 'created', + 'modified', + ] + } + ] + }, + { + "name": "Knowledge Base", + "slug": "kb_articles", + "sections": [ + { + "layout": "table", + "field": "knowledge_base", + } + ] + }, + { + "name": "Tickets", + "slug": "tickets", + "sections": [ + { + "layout": "table", + "field": "tickets", + } + ] + }, + { + "name": "Notes", + "slug": "notes", + "sections": [] + }, + ] + + table_fields: list = [ + 'name', + 'organization', + 'created', + ] + + + def clean(self): + + super().clean()