Skip to content

Commit

Permalink
[IMP] hr_contract_employee_calendar_planning: test performance improv…
Browse files Browse the repository at this point in the history
…ement

- Include context keys for avoiding mail operations overhead.
  • Loading branch information
josep-tecnativa committed Oct 19, 2023
1 parent 0efddae commit d463d1e
Showing 1 changed file with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,27 @@


class TestHrContractEmployeeCalendarPlanning(TestContractCommon):
def setUp(self):
super().setUp()
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,
mail_create_nolog=True,
mail_create_nosubscribe=True,
mail_notrack=True,
no_reset_password=True,
tracking_disable=True,
)
)
calendar_ids = [
(
0,
0,
{
"date_start": False,
"date_end": datetime.strptime("2020-11-30", "%Y-%m-%d").date(),
"calendar_id": self.env["resource.calendar"].browse([2]).id,
"calendar_id": cls.env["resource.calendar"].browse([2]).id,
},
),
(
Expand All @@ -24,11 +35,11 @@ def setUp(self):
{
"date_start": datetime.strptime("2020-12-01", "%Y-%m-%d").date(),
"date_end": False,
"calendar_id": self.env["resource.calendar"].browse([1]).id,
"calendar_id": cls.env["resource.calendar"].browse([1]).id,
},
),
]
self.employee.calendar_ids = calendar_ids
cls.employee.calendar_ids = calendar_ids

def test_calendar_migration_from_contracts(self):
self.contract1 = self.env["hr.contract"].create(
Expand Down

0 comments on commit d463d1e

Please sign in to comment.