Automatic absolute time_spent calculation for ticket FollowUp

This commit is contained in:
Sam Splunks 2024-02-13 08:59:48 +00:00
parent f379bbe80e
commit f7e3a2b8aa
2 changed files with 9 additions and 1 deletions

View File

@ -1000,8 +1000,11 @@ class FollowUp(models.Model):
return u"%s#followup%s" % (self.ticket.get_absolute_url(), self.id)
def save(self, *args, **kwargs):
now = timezone.now()
t = self.ticket
t.modified = timezone.now()
if helpdesk_settings.FOLLOWUP_TIME_SPENT_AUTO and not self.time_spent:
self.time_spent = now - t.modified
t.modified = now
t.save()
super(FollowUp, self).save(*args, **kwargs)

View File

@ -151,6 +151,11 @@ TICKET_PRIORITY_CHOICES = getattr(settings,
'HELPDESK_TICKET_PRIORITY_CHOICES',
DEFAULT_TICKET_PRIORITY_CHOICES)
# Follow-ups automatic time_spent calculation
FOLLOWUP_TIME_SPENT_AUTO = getattr(settings,
'HELPDESK_FOLLOWUP_TIME_SPENT_AUTO',
False)
############################
# options for public pages #
############################