Files
enterprise-addons/hr_payroll/tests/test_payroll_dependencies.py
T

30 lines
1.7 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests.common import TransactionCase
from odoo.tests import tagged
class TestPayrollDependencies(TransactionCase):
def test_l10n_xx_hr_payroll_no_account(self):
for module in self.env['ir.module.module'].search([('name', '=like', 'l10n____hr_payroll')]):
dependencies = module.upstream_dependencies(exclude_states=('uninstallable')).mapped('name')
self.assertTrue('hr_payroll' in dependencies, "The payroll localization %s should depend on payroll" % module.name)
self.assertFalse('account' in dependencies, "The payroll localization %s shouldn't depend on accounting" % module.name)
for module in self.env['ir.module.module'].search([('name', '=like', 'l10n____hr_payroll_account')]):
dependencies = module.upstream_dependencies(exclude_states=('uninstallable')).mapped('name')
self.assertTrue(module.name[:18] in dependencies, "The payroll localization %s should depend on %s" % (module.name, module.name[:18]))
self.assertTrue('account' in dependencies, "The payroll localization %s shouldn't depend on accounting" % module.name)
@tagged('post_install', '-at_install')
class TestSalaryRuleConfiguration(TransactionCase):
def test_hr_salary_rule_updatable(self):
all_rules = self.env['hr.salary.rule'].search([])
all_xmlids = self.env['ir.model.data'].search([('model', '=', "hr.salary.rule"), ('res_id', 'in', all_rules.ids)])
noupdate_xmlids = all_xmlids.filtered('noupdate')
self.assertFalse(noupdate_xmlids, "Following salary rules shouldn't be noupdate\n%s" % ('\n'.join(noupdate_xmlids.mapped('complete_name'))))