Skip to content

Commit

Permalink
[FIX] fix stage search
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierrick Brun committed Dec 8, 2022
1 parent 83ec439 commit 1852ca4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions helpdesk_mgmt_reopen/models/mail_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def is_production_env(self):
It is useful because we can't (easily) mock
incoming emails in testing environnements
It needs to be implemented"""
return False
return True

@api.model
def is_reopener_message(self, vals):
Expand All @@ -34,7 +34,9 @@ def create(self, vals):
[("id", "=", vals.get("res_id"))]
)
if ticket:
if ticket.stage_id.is_close:
stage = ticket.team_id.mapped("stage_ids").sorted("sequence")[0]
if ticket.stage_id.closed:
stage = self.env["helpdesk.ticket.stage"].search(
[], order="sequence", limit=1
)
ticket.stage_id = stage
return super(MailMessage, self).create(vals)

0 comments on commit 1852ca4

Please sign in to comment.