Skip to content

Ticket Object


This page contains the Ticket API Documentation.

Ticket Status

Ticket Status

Status of the ticket. By design, not all statuses are available for ALL ticket types.

Request / Incident ticket

  • Draft
  • New
  • Assigned
  • Assigned (Planned)
  • Pending
  • Solved
  • Closed

Problem Ticket

  • Draft
  • New
  • Accepted
  • Assigned
  • Assigned (Planned)
  • Pending
  • Solved
  • Under Observation
  • Closed

Change Ticket

  • Draft
  • New
  • Evaluation
  • Approvals
  • Accepted
  • Pending
  • Testing
  • Qualification
  • Applied
  • Review
  • Closed
  • Cancelled
  • Refused

Ticket External System

Bases: IntegerChoices

Attributes

GITHUB = (TicketValues.ExternalSystem._GITHUB_INT, TicketValues.ExternalSystem._GITHUB_VALUE)

GITLAB = (TicketValues.ExternalSystem._GITLAB_INT, TicketValues.ExternalSystem._GITLAB_VALUE)

CUSTOM_1 = (TicketValues.ExternalSystem._CUSTOM_1_INT, TicketValues.ExternalSystem._CUSTOM_1_VALUE)

CUSTOM_2 = (TicketValues.ExternalSystem._CUSTOM_2_INT, TicketValues.ExternalSystem._CUSTOM_2_VALUE)

CUSTOM_3 = (TicketValues.ExternalSystem._CUSTOM_3_INT, TicketValues.ExternalSystem._CUSTOM_3_VALUE)

CUSTOM_4 = (TicketValues.ExternalSystem._CUSTOM_4_INT, TicketValues.ExternalSystem._CUSTOM_4_VALUE)

CUSTOM_5 = (TicketValues.ExternalSystem._CUSTOM_5_INT, TicketValues.ExternalSystem._CUSTOM_5_VALUE)

CUSTOM_6 = (TicketValues.ExternalSystem._CUSTOM_6_INT, TicketValues.ExternalSystem._CUSTOM_6_VALUE)

CUSTOM_7 = (TicketValues.ExternalSystem._CUSTOM_7_INT, TicketValues.ExternalSystem._CUSTOM_7_VALUE)

CUSTOM_8 = (TicketValues.ExternalSystem._CUSTOM_8_INT, TicketValues.ExternalSystem._CUSTOM_8_VALUE)

CUSTOM_9 = (TicketValues.ExternalSystem._CUSTOM_9_INT, TicketValues.ExternalSystem._CUSTOM_9_VALUE)

Ticket Type

Bases: IntegerChoices

Centurion ERP has the following ticket types available:

  • Request

  • Incident

  • Change

  • Problem

As we use a common model for ALL ticket types. Effort has been made to limit fields showing for a ticket type that it does not belong. If you find a field displayed that does not belong to a ticket, please create an issue.

Danger

The API does not filter ticket fields. It's important not to edit a field that does not belong to the ticket type selected, as this will cause the ticket validation to fail.

Attributes

REQUEST = ('1', 'Request')

INCIDENT = ('2', 'Incident')

CHANGE = ('3', 'Change')

PROBLEM = ('4', 'Problem')

ISSUE = ('5', 'Issue')

MERGE_REQUEST = ('6', 'Merge Request')

PROJECT_TASK = ('7', 'Project Task')

Ticket Urgency

Bases: IntegerChoices

Attributes

VERY_LOW = ('1', 'Very Low')

LOW = ('2', 'Low')

MEDIUM = ('3', 'Medium')

HIGH = ('4', 'High')

VERY_HIGH = ('5', 'Very High')

Ticket Impact

Bases: IntegerChoices

Attributes

VERY_LOW = ('1', 'Very Low')

LOW = ('2', 'Low')

MEDIUM = ('3', 'Medium')

HIGH = ('4', 'High')

VERY_HIGH = ('5', 'Very High')

Ticket Priority

Bases: IntegerChoices

Attributes

VERY_LOW = (TicketValues.Priority._VERY_LOW_INT, TicketValues.Priority._VERY_LOW_VALUE)

LOW = (TicketValues.Priority._LOW_INT, TicketValues.Priority._LOW_VALUE)

MEDIUM = (TicketValues.Priority._MEDIUM_INT, TicketValues.Priority._MEDIUM_VALUE)

HIGH = (TicketValues.Priority._HIGH_INT, TicketValues.Priority._HIGH_VALUE)

VERY_HIGH = (TicketValues.Priority._VERY_HIGH_INT, TicketValues.Priority._VERY_HIGH_VALUE)

MAJOR = (TicketValues.Priority._MAJOR_INT, TicketValues.Priority._MAJOR_VALUE)

Ticket Object Model Abstract class

Bases: SlashCommands, TenancyObject, TicketCommonFields

Attributes

save_model_history: bool = False

model_notes = None

is_global = None

status = models.IntegerField(blank=False, choices=TicketStatus.All, default=TicketStatus.All.NEW, help_text='Status of ticket', verbose_name='Status')

category = models.ForeignKey(TicketCategory, blank=True, help_text='Category for this ticket', null=True, on_delete=models.SET_NULL, verbose_name='Category')

title = models.CharField(blank=False, help_text='Title of the Ticket', max_length=100, unique=True, verbose_name='Title')

description = models.TextField(blank=False, help_text='Ticket Description', null=False, verbose_name='Description')

urgency = models.IntegerField(blank=True, choices=TicketUrgency, default=TicketUrgency.VERY_LOW, help_text='How urgent is this tickets resolution for the user?', null=True, verbose_name='Urgency')

impact = models.IntegerField(blank=True, choices=TicketImpact, default=TicketImpact.VERY_LOW, help_text='End user assessed impact', null=True, verbose_name='Impact')

priority = models.IntegerField(blank=True, choices=TicketPriority, default=TicketPriority.VERY_LOW, help_text='What priority should this ticket for its completion', null=True, verbose_name='Priority')

external_ref = models.IntegerField(blank=True, default=None, help_text='External System reference', null=True, verbose_name='Reference Number')

external_system = models.IntegerField(blank=True, choices=Ticket_ExternalSystem, default=None, help_text='External system this item derives', null=True, verbose_name='External System')

ticket_type = models.IntegerField(blank=False, choices=TicketType, help_text='The type of ticket this is', validators=[validation_ticket_type], verbose_name='Type')

project = models.ForeignKey(Project, blank=True, help_text='Assign to a project', null=True, on_delete=models.SET_NULL, verbose_name='Project')

milestone = models.ForeignKey(ProjectMilestone, blank=True, help_text='Assign to a milestone', null=True, on_delete=models.SET_NULL, verbose_name='Project Milestone')

opened_by = models.ForeignKey(User, blank=False, help_text='Who is the ticket for', null=False, on_delete=models.DO_NOTHING, related_name='opened_by', verbose_name='Opened By')

subscribed_users = models.ManyToManyField(User, blank=True, help_text='Subscribe a User(s) to the ticket to receive updates', related_name='subscribed_users', symmetrical=False, verbose_name='Subscribed User(s)')

subscribed_teams = models.ManyToManyField(Team, blank=True, help_text='Subscribe a Team(s) to the ticket to receive updates', related_name='subscribed_teams', symmetrical=False, verbose_name='Subscribed Team(s)')

assigned_users = models.ManyToManyField(User, blank=True, help_text='Assign the ticket to a User(s)', related_name='assigned_users', symmetrical=False, verbose_name='Assigned User(s)')

assigned_teams = models.ManyToManyField(Team, blank=True, help_text='Assign the ticket to a Team(s)', related_name='assigned_teams', symmetrical=False, verbose_name='Assigned Team(s)')

is_deleted = models.BooleanField(blank=False, default=False, help_text='Is the ticket deleted? And ready to be purged', null=False, verbose_name='Deleted')

date_closed = models.DateTimeField(blank=True, help_text='Date ticket closed', null=True, verbose_name='Closed Date')

planned_start_date = models.DateTimeField(blank=True, help_text='Planned start date.', null=True, verbose_name='Planned Start Date')

planned_finish_date = models.DateTimeField(blank=True, help_text='Planned finish date', null=True, verbose_name='Planned Finish Date')

estimate = models.IntegerField(blank=False, default=0, help_text='Time Eastimated to complete this ticket in seconds', null=False, verbose_name='Estimation')

real_start_date = models.DateTimeField(blank=True, help_text='Real start date', null=True, verbose_name='Real Start Date')

real_finish_date = models.DateTimeField(blank=True, help_text='Real finish date', null=True, verbose_name='Real Finish Date')

page_layout: list = []

table_fields: list = ['id', 'title', 'status_badge', 'opened_by', 'organization', 'created']

common_fields: list(str()) = ['organization', 'title', 'description', 'opened_by', 'ticket_type', 'assigned_users', 'assigned_teams', 'estimate']

common_itsm_fields: list(str()) = common_fields + ['status', 'categoryurgency', 'project', 'milestone', 'priority', 'impact', 'subscribed_teams', 'subscribed_users']

fields_itsm_request: list(str()) = common_itsm_fields + []

fields_itsm_incident: list(str()) = common_itsm_fields + []

fields_itsm_problem: list(str()) = common_itsm_fields + []

fields_itsm_change: list(str()) = common_itsm_fields + []

common_git_fields: list(str()) = common_fields + []

fields_git_issue: list(str()) = common_fields + []

fields_git_merge_request: list(str()) = common_fields + []

fields_project_task: list(str()) = common_fields + ['category', 'milestone', 'status', 'urgency', 'priority', 'impact', 'subscribed_teams', 'subscribed_users', 'planned_start_date', 'planned_finish_date', 'real_start_date', 'real_finish_date']

tech_fields = ['category', 'project', 'milestone', 'assigned_users', 'assigned_teams', 'subscribed_teams', 'subscribed_users', 'status', 'urgency', 'impact', 'priority', 'planned_start_date', 'planned_finish_date']

comments

duration_ticket: str

linked_items: list(dict())

Fetch items linked to ticket

Returns:

Type Description
list(dict())

List of dict (list): List of dictionary with fields: id, name, type and url.

list(dict())

Empty List (list): No items were found

related_tickets: list(dict())

status_badge

Classes

Meta

Attributes
ordering = ['id']
permissions = [('add_ticket_request', 'Can add a request ticket'), ('change_ticket_request', 'Can change any request ticket'), ('delete_ticket_request', 'Can delete a request ticket'), ('import_ticket_request', 'Can import a request ticket'), ('purge_ticket_request', 'Can purge a request ticket'), ('triage_ticket_request', 'Can triage all request ticket'), ('view_ticket_request', 'Can view all request ticket'), ('add_ticket_incident', 'Can add a incident ticket'), ('change_ticket_incident', 'Can change any incident ticket'), ('delete_ticket_incident', 'Can delete a incident ticket'), ('import_ticket_incident', 'Can import a incident ticket'), ('purge_ticket_incident', 'Can purge a incident ticket'), ('triage_ticket_incident', 'Can triage all incident ticket'), ('view_ticket_incident', 'Can view all incident ticket'), ('add_ticket_problem', 'Can add a problem ticket'), ('change_ticket_problem', 'Can change any problem ticket'), ('delete_ticket_problem', 'Can delete a problem ticket'), ('import_ticket_problem', 'Can import a problem ticket'), ('purge_ticket_problem', 'Can purge a problem ticket'), ('triage_ticket_problem', 'Can triage all problem ticket'), ('view_ticket_problem', 'Can view all problem ticket'), ('add_ticket_change', 'Can add a change ticket'), ('change_ticket_change', 'Can change any change ticket'), ('delete_ticket_change', 'Can delete a change ticket'), ('import_ticket_change', 'Can import a change ticket'), ('purge_ticket_change', 'Can purge a change ticket'), ('triage_ticket_change', 'Can triage all change ticket'), ('view_ticket_change', 'Can view all change ticket'), ('add_ticket_project_task', 'Can add a project task'), ('change_ticket_project_task', 'Can change any project task'), ('delete_ticket_project_task', 'Can delete a project task'), ('import_ticket_project_task', 'Can import a project task'), ('purge_ticket_project_task', 'Can purge a project task'), ('triage_ticket_project_task', 'Can triage all project task'), ('view_ticket_project_task', 'Can view all project task')]
unique_together = ('external_system', 'external_ref')
verbose_name = 'Ticket'
verbose_name_plural = 'Tickets'

Functions

validation_ticket_type(field)

validation_title(field)

__str__()

get_url(request=None)

save(force_insert=False, force_update=False, using=None, update_fields=None)

ticketassigned(instance)

Check if the ticket has any assigned user(s)/team(s)

assigned_status_update(instance)

Update Ticket status based off of assigned

  • If the ticket has any assigned team(s)/user(s), update the status to assigned.
  • If the ticket does not have any assigned team(s)/user(s), update the status to new.

This method only updates the status if the existing status is New or Assigned.

action_comment_ticket_users(sender, instance, action, reverse, model, pk_set, **kwargs)

Ticket *_users many2many field

  • Create the action comment
  • Update ticket status to New/Assigned

action_comment_ticket_teams(sender, instance, action, reverse, model, pk_set, **kwargs)

Ticket *_teams many2many field

  • Create the action comment
  • Update ticket status to New/Assigned

About:

This page forms part of our Project Centurion ERP.

Page Metadata
Version: ToDo: place files short git commit here
Date Created: 2024-09-01
Date Edited: 2024-09-01

Contribution:

Would You like to contribute to our Centurion ERP project? You can assist in the following ways:

 

ToDo: Add the page list of contributors