Skip to content

Commit

Permalink
[IMP] helpdesk_mgmt: Add specific use cases with team without company_id
Browse files Browse the repository at this point in the history
  • Loading branch information
victoralmau authored and giarve committed Oct 25, 2024
1 parent e14e66f commit 721eee0
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions helpdesk_mgmt/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def setUpClass(cls):
"mail_notrack": True,
"no_reset_password": True,
}
cls.company = cls.env.company
cls.user_own = new_test_user(
cls.env,
login="helpdesk_mgmt-user_own",
Expand Down
50 changes: 50 additions & 0 deletions helpdesk_mgmt/tests/test_helpdesk_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,56 @@ def setUpClass(cls):
super().setUpClass()
cls.ticket = cls.ticket_a_unassigned

def test_helpdesk_ticket_team_company(self):
ticket_a = self.env["helpdesk.ticket"].create(
{
"name": "Test ticket A",
"team_id": self.team_a.id,
"description": "description",
}
)
self.assertEqual(ticket_a.company_id, self.company)
self.team_b.company_id = False
ticket_b = self.env["helpdesk.ticket"].create(
{
"name": "Test ticket b",
"team_id": self.team_b.id,
"description": "description",
}
)
self.assertEqual(ticket_b.company_id, self.company)

def test_helpdesk_ticket_team_company_extra(self):
company = self.env["res.company"].create({"name": "Test company"})
team = self.env["helpdesk.ticket.team"].create(
{"name": "Test team", "company_id": False}
)
ticket = (
self.env["helpdesk.ticket"]
.with_company(company)
.create(
{
"name": "Test ticket",
"team_id": team.id,
"description": "description",
}
)
)
self.assertEqual(ticket.company_id, company)
team.company_id = self.company
ticket = (
self.env["helpdesk.ticket"]
.with_company(company)
.create(
{
"name": "Test ticket",
"team_id": team.id,
"description": "description",
}
)
)
self.assertEqual(ticket.company_id, self.company)

def test_helpdesk_ticket_datetimes(self):
old_stage_update = self.ticket.last_stage_update
self.assertTrue(
Expand Down

0 comments on commit 721eee0

Please sign in to comment.