Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def _get_autodraft_sheet_values(self):
self.company_id, self.date
),
"date_end": HrTimesheetSheet._get_period_end(self.company_id, self.date),
"department_id": self.employee_id.department_id.id,
}

def action_autodraft_timesheet_sheets(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def setUp(self):
self.ResUsers = self.env["res.users"]
self.Company = self.env["res.company"]
self.Project = self.env["project.project"]
self.HrDepartment = self.env["hr.department"]
self.HrEmployee = self.env["hr.employee"]
self.HrTimesheetSheet = self.env["hr_timesheet.sheet"]
self.AccountAnalyticLine = self.env["account.analytic.line"]
Expand Down Expand Up @@ -43,7 +44,10 @@ def test_autocreate(self):
"company_id": self.company_id.id,
}
)
employee = self.HrEmployee.create({"name": "Employee", "user_id": user.id})
department = self.HrDepartment.create({"name": "Department 1"})
employee = self.HrEmployee.create(
{"name": "Employee", "user_id": user.id, "department_id": department.id}
)
project = self.Project.create({"name": "Project"})

aal_1 = self.AccountAnalyticLine.create(
Expand All @@ -67,6 +71,7 @@ def test_autocreate(self):
self.assertTrue(aal_1.sheet_id)
self.assertTrue(aal_2.sheet_id)
self.assertEqual(aal_1.sheet_id, aal_2.sheet_id)
self.assertEqual(aal_1.sheet_id.department_id, employee.department_id)

def test_already_confirmed(self):
user = self.ResUsers.sudo().create(
Expand Down