From c5931f94fb0aeed333b8071f8ff5f93c5b209ebb Mon Sep 17 00:00:00 2001 From: Carmen Bianca BAKKER Date: Fri, 28 Jun 2024 11:53:56 +0200 Subject: [PATCH] [FIX] hr_timesheet_begin_end: Test uses timesheet lines now Timesheet lines are characterised by having a project. Signed-off-by: Carmen Bianca BAKKER --- .../readme/newsfragments/693.bugfix.1.rst | 1 + .../tests/test_timesheet_begin_end.py | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 hr_timesheet_activity_begin_end/readme/newsfragments/693.bugfix.1.rst diff --git a/hr_timesheet_activity_begin_end/readme/newsfragments/693.bugfix.1.rst b/hr_timesheet_activity_begin_end/readme/newsfragments/693.bugfix.1.rst new file mode 100644 index 0000000000..056c17a06b --- /dev/null +++ b/hr_timesheet_activity_begin_end/readme/newsfragments/693.bugfix.1.rst @@ -0,0 +1 @@ +Fixed the test to use timesheet lines instead of bare analytic lines. diff --git a/hr_timesheet_activity_begin_end/tests/test_timesheet_begin_end.py b/hr_timesheet_activity_begin_end/tests/test_timesheet_begin_end.py index 620e6d8c1f..a8e2c88958 100644 --- a/hr_timesheet_activity_begin_end/tests/test_timesheet_begin_end.py +++ b/hr_timesheet_activity_begin_end/tests/test_timesheet_begin_end.py @@ -9,17 +9,16 @@ class TestBeginEnd(common.TransactionCase): def setUp(self): super(TestBeginEnd, self).setUp() self.timesheet_line_model = self.env['account.analytic.line'] - self.analytic = self.env.ref('analytic.analytic_administratif') - self.user = self.env.ref('base.user_root') + self.project = self.env.ref('project.project_project_1') + self.employee = self.env.ref('hr.employee_qdp') self.base_line = { 'name': 'test', 'date': fields.Date.today(), 'time_start': 10., 'time_stop': 12., - 'user_id': self.user.id, 'unit_amount': 2., - 'account_id': self.analytic.id, - 'amount': -60., + 'project_id': self.project.id, + 'employee_id': self.employee.id, } def test_onchange(self): @@ -27,6 +26,7 @@ def test_onchange(self): 'name': 'test', 'time_start': 10., 'time_stop': 12., + 'project_id': self.project.id, }) line.onchange_hours_start_stop() self.assertEquals(line.unit_amount, 2)