feat(core): Parent Ticket validation added to ticket serializer
ref: #554 closes #517
This commit is contained in:
@ -310,6 +310,28 @@ class TicketModelSerializer(
|
|||||||
data['status'] = int(Ticket.TicketStatus.All.NEW)
|
data['status'] = int(Ticket.TicketStatus.All.NEW)
|
||||||
|
|
||||||
|
|
||||||
|
if(
|
||||||
|
data['parent_ticket']
|
||||||
|
and (
|
||||||
|
self._context['view'].action == 'partial_update'
|
||||||
|
or self._context['view'].action == 'update'
|
||||||
|
)
|
||||||
|
):
|
||||||
|
|
||||||
|
if not data['parent_ticket'].circular_dependency_check(
|
||||||
|
ticket = self.instance,
|
||||||
|
parent = data['parent_ticket']
|
||||||
|
):
|
||||||
|
|
||||||
|
raise centurion_exception.ValidationError(
|
||||||
|
detail = {
|
||||||
|
'parent_ticket': 'Adding this ticket will create a circular dependency'
|
||||||
|
},
|
||||||
|
code = 'no_parent_circular_dependency',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.validate_field_organization()
|
self.validate_field_organization()
|
||||||
|
|
||||||
self.validate_field_milestone()
|
self.validate_field_milestone()
|
||||||
|
Reference in New Issue
Block a user