Skip to content

Commit

Permalink
[IMP] helpdesk_ticket_type_team
Browse files Browse the repository at this point in the history
  • Loading branch information
SMaciasOSI committed Feb 1, 2024
1 parent 9787317 commit 127c651
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions helpdesk_ticket_type_team/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import helpdesk_ticket
from . import helpdesk_ticket_type
from . import helpdesk_team
from . import res_users
8 changes: 7 additions & 1 deletion helpdesk_ticket_type_team/models/helpdesk_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ class HelpdeskTicket(models.Model):
@api.onchange("team_id")
def _onchange_team_id(self):
self.ticket_type_id = False
self.user_id = False
if not self.team_id or not self.team_id.ticket_type_ids:
return {"domain": {"ticket_type_id": [("team_id", "=", False)]}}
else:
return {"domain": {"ticket_type_id": [("team_id", "=", self.team_id.id)]}}
return {
"domain": {
"ticket_type_id": [("team_id", "=", self.team_id.id)],
"user_id": [("team_ids", "=", self.team_id.id)],
}
}
7 changes: 7 additions & 0 deletions helpdesk_ticket_type_team/models/res_users.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from odoo import fields, models


class ResUsers(models.Model):
_inherit = "res.users"

team_ids = fields.Many2many("helpdesk.team")

0 comments on commit 127c651

Please sign in to comment.