110 lines
4.3 KiB
Python
110 lines
4.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
from odoo.tests import TransactionCase, tagged
|
|
|
|
|
|
@tagged('post_install', '-at_install')
|
|
class TestExpPayrollPromotion(TransactionCase):
|
|
"""Test cases for exp_payroll_promotion module"""
|
|
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
super().setUpClass()
|
|
# Create test employee
|
|
cls.employee = cls.env['hr.employee'].create({
|
|
'name': 'Test Employee Promotion',
|
|
})
|
|
|
|
def test_01_employee_promotions_model_exists(self):
|
|
"""Test that employee.promotions model is accessible"""
|
|
Model = self.env['employee.promotions']
|
|
self.assertTrue(Model, "employee.promotions model should exist")
|
|
|
|
def test_02_employee_promotions_has_required_fields(self):
|
|
"""Test that employee.promotions has all required fields from this module"""
|
|
Model = self.env['employee.promotions']
|
|
required_fields = [
|
|
'promotion_scale_id',
|
|
'current_job_id',
|
|
'promotion_job_id',
|
|
'date_promotion',
|
|
'type',
|
|
'eligible',
|
|
'unmet_condition',
|
|
'permit',
|
|
'foreign_scale',
|
|
'service_year',
|
|
'service_month',
|
|
'service_day',
|
|
'current_salary',
|
|
'new_salary',
|
|
'old_basic_salary',
|
|
'new_basic_salary',
|
|
]
|
|
for field in required_fields:
|
|
self.assertIn(
|
|
field,
|
|
Model._fields,
|
|
f"employee.promotions should have {field} field"
|
|
)
|
|
|
|
def test_03_promotion_type_selection_values(self):
|
|
"""Test that promotion type has correct selection values"""
|
|
Model = self.env['employee.promotions']
|
|
type_field = Model._fields.get('type')
|
|
self.assertTrue(type_field, "type field should exist")
|
|
# Check selection values include regular and exceptional
|
|
selection = type_field.selection
|
|
if callable(selection):
|
|
selection = selection(Model)
|
|
selection_values = [s[0] for s in selection]
|
|
self.assertIn('regular', selection_values, "type should have 'regular' option")
|
|
self.assertIn('exceptional', selection_values, "type should have 'exceptional' option")
|
|
|
|
def test_04_hr_payroll_promotion_setting_model_exists(self):
|
|
"""Test that hr.payroll.promotion.setting model is accessible"""
|
|
Model = self.env['hr.payroll.promotion.setting']
|
|
self.assertTrue(Model, "hr.payroll.promotion.setting model should exist")
|
|
|
|
def test_05_hr_payroll_raise_model_exists(self):
|
|
"""Test that hr.payroll.raise model is accessible"""
|
|
Model = self.env['hr.payroll.raise']
|
|
self.assertTrue(Model, "hr.payroll.raise model should exist")
|
|
|
|
def test_06_hr_payroll_nomination_model_exists(self):
|
|
"""Test that hr.payroll.nomination model is accessible"""
|
|
Model = self.env['hr.payroll.nomination']
|
|
self.assertTrue(Model, "hr.payroll.nomination model should exist")
|
|
|
|
def test_07_hr_penalty_register_model_exists(self):
|
|
"""Test that hr.penalty.register model is accessible"""
|
|
Model = self.env['hr.penalty.register']
|
|
self.assertTrue(Model, "hr.penalty.register model should exist")
|
|
|
|
def test_08_hr_official_mission_model_exists(self):
|
|
"""Test that hr.official.mission model is accessible"""
|
|
Model = self.env['hr.official.mission']
|
|
self.assertTrue(Model, "hr.official.mission model should exist")
|
|
|
|
def test_09_hr_holidays_has_studying_leave(self):
|
|
"""Test that hr.holidays has studying_leave field"""
|
|
HolidaysStatus = self.env['hr.holidays.status']
|
|
self.assertIn(
|
|
'studying_leave',
|
|
HolidaysStatus._fields,
|
|
"hr.holidays.status should have studying_leave field"
|
|
)
|
|
|
|
def test_10_hr_holidays_has_successful_completion(self):
|
|
"""Test that hr.holidays has successful_completion field"""
|
|
Holidays = self.env['hr.holidays']
|
|
self.assertIn(
|
|
'successful_completion',
|
|
Holidays._fields,
|
|
"hr.holidays should have successful_completion field"
|
|
)
|
|
|
|
def test_11_hr_payroll_structure_model_accessible(self):
|
|
"""Test that hr.payroll.structure model is accessible"""
|
|
Model = self.env['hr.payroll.structure']
|
|
self.assertTrue(Model, "hr.payroll.structure model should exist")
|