-
-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[16.0][FIX] helpdesk_ticket_partner_response: Fix mail thread change …
…stage
- Loading branch information
Showing
5 changed files
with
475 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import helpdesk_ticket_team | ||
from . import mail_thread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from odoo import api, models | ||
|
||
|
||
class MailThread(models.AbstractModel): | ||
_inherit = "mail.thread" | ||
|
||
@api.model | ||
def _message_route_process(self, message, message_dict, routes): | ||
self.change_status_ticket_from_portal(routes) | ||
return super()._message_route_process(message, message_dict, routes) | ||
|
||
def change_status_ticket_from_portal(self, routes): | ||
if routes and routes[0][0] == "helpdesk.ticket": | ||
ticket_id = routes[0][1] | ||
ticket = self.env["helpdesk.ticket"].sudo().browse(int(ticket_id)) | ||
partner_id = ( | ||
self.env["res.users"] | ||
.search([("id", "=", routes[0][3])], limit=1) | ||
.partner_id.id | ||
) | ||
if ( | ||
ticket | ||
and partner_id == ticket.partner_id.id | ||
and ticket.team_id.autoupdate_ticket_stage | ||
and ticket.stage_id in ticket.team_id.autopupdate_src_stage_ids | ||
): | ||
ticket.stage_id = ticket.team_id.autopupdate_dest_stage_id.id | ||
Oops, something went wrong.