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 = ('1', 'Github')

GITLAB = ('2', 'Gitlab')

CUSTOM_1 = ('9999', 'Custom #1 (Imported)')

CUSTOM_2 = ('9998', 'Custom #2 (Imported)')

CUSTOM_3 = ('9997', 'Custom #3 (Imported)')

CUSTOM_4 = ('9996', 'Custom #4 (Imported)')

CUSTOM_5 = ('9995', 'Custom #5 (Imported)')

CUSTOM_6 = ('9994', 'Custom #6 (Imported)')

CUSTOM_7 = ('9993', 'Custom #7 (Imported)')

CUSTOM_8 = ('9992', 'Custom #8 (Imported)')

CUSTOM_9 = ('9991', 'Custom #9 (Imported)')

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 = ('1', 'Very Low')

LOW = ('2', 'Low')

MEDIUM = ('3', 'Medium')

HIGH = ('4', 'High')

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

MAJOR = ('6', 'Major')

Ticket Object Model Abstract class

Bases: 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')

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

description = models.TextField(blank=False, default=None, 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.DO_NOTHING, verbose_name='Project')

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')

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')

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

common_itsm_fields: list(str()) = common_fields + ['status', 'urgency', 'project', '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 + ['status', 'urgency', 'priority', 'impact', 'subscribed_teams', 'subscribed_users', 'planned_start_date', 'planned_finish_date', 'real_start_date', 'real_finish_date']

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

comments

duration_ticket: str

related_tickets: list(dict())

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__()

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