def test_allocation_request(self): """ Create an allocation request """ # employee should be set to current user allocation_form = Form(self.env['hr.leave.allocation'].with_user( self.user_employee)) allocation_form.holiday_status_id = self.holidays_type_1 allocation_form.name = 'New Allocation Request' allocation = allocation_form.save()
def test_department_leave(self): """ Create a department leave """ self.employee_hrmanager.write({'department_id': self.hr_dept.id}) self.assertFalse(self.env['hr.leave'].search([ ('employee_id', 'in', self.hr_dept.member_ids.ids) ])) leave_form = Form(self.env['hr.leave'].with_user(self.user_hrmanager), view='hr_holidays.hr_leave_view_form_manager') leave_form.holiday_type = 'department' leave_form.department_id = self.hr_dept leave_form.holiday_status_id = self.holidays_type_1 leave = leave_form.save() leave.action_approve() member_ids = self.hr_dept.member_ids.ids self.assertEqual( self.env['hr.leave'].search_count([('employee_id', 'in', member_ids)]), len(member_ids), "Leave should be created for members of department")