Skip to content

[18.0][FIX] helpdesk_mgmt_sla: use _get_resource_calendar() with fallback for SLA calculations#885

Closed
xaviedoanhduy wants to merge 1 commit intoOCA:18.0from
xaviedoanhduy:18.0-fix-sla-resource_calendar_id
Closed

[18.0][FIX] helpdesk_mgmt_sla: use _get_resource_calendar() with fallback for SLA calculations#885
xaviedoanhduy wants to merge 1 commit intoOCA:18.0from
xaviedoanhduy:18.0-fix-sla-resource_calendar_id

Conversation

@xaviedoanhduy
Copy link
Copy Markdown

@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.

@github-actions
Copy link
Copy Markdown

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions Bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Mar 22, 2026
@github-actions github-actions Bot closed this Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale PR/Issue without recent activity, it'll be soon closed automatically.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant