Skip to content

Conversation

@xaviedoanhduy
Copy link

@xaviedoanhduy xaviedoanhduy commented Nov 17, 2025

Currently, SLA computations (_compute_sla_data, _compute_deadline, _stage_recompute) access the calendar directly via ticket_id.team_id.resource_calendar_id. This approach causes errors when:

  • The ticket has no assigned team (team_id = False), or
  • The SLA is running while the ticket is being updated.

These situations lead to singleton or NoneType errors, causing SLA computation to crash.
Screencast from 2025-11-17 16-09-08.webm

Introduce _get_resource_calendar() to safely retrieve a calendar for SLA computations:

  • Fallback order: user → team → ticket company → default company calendar.
  • Benefits: prevents singleton or None errors when a ticket has no team or user, and prioritizes the user’s working hours for SLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant