From bd04e4170df36c37375337e87c12dcbdf5dc4261 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 19 Dec 2024 14:19:32 +0930 Subject: [PATCH] feat(core): Link Organization to ticket ref: #416 #421 #426 --- app/core/lib/slash_commands/linked_model.py | 8 ++++++++ app/core/models/ticket/ticket_linked_items.py | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/app/core/lib/slash_commands/linked_model.py b/app/core/lib/slash_commands/linked_model.py index 846a48f3c..159e3a36a 100644 --- a/app/core/lib/slash_commands/linked_model.py +++ b/app/core/lib/slash_commands/linked_model.py @@ -108,6 +108,14 @@ def command_linked_model(self, match) -> str: item_type = TicketLinkedItem.Modules.OPERATING_SYSTEM + elif model_type == 'organization': + + from access.models import Organization + + model = Organization + + item_type = TicketLinkedItem.Modules.ORGANIZATION + elif model_type == 'service': from itim.models.services import Service diff --git a/app/core/models/ticket/ticket_linked_items.py b/app/core/models/ticket/ticket_linked_items.py index e6897f88f..07b8546ba 100644 --- a/app/core/models/ticket/ticket_linked_items.py +++ b/app/core/models/ticket/ticket_linked_items.py @@ -33,6 +33,7 @@ class Modules(models.IntegerChoices): SOFTWARE = 6, 'Software' KB = 7, 'Knowledge Base Article' + ORGANIZATION = 8, 'Organization' is_global = None @@ -123,6 +124,10 @@ def __str__(self) -> str: item_type = 'operating_system' + elif self.item_type == TicketLinkedItem.Modules.ORGANIZATION: + + item_type = 'organization' + elif self.item_type == TicketLinkedItem.Modules.SERVICE: item_type = 'service'