[IMP] account: test install of all l10n modules

l10n modules are blacklisted on the runbot.
With this commit, a tagged test is added that installs all the l10n
modules. A chart of account is installed in a different company for each
one. This test is a first step to test all l10n. It's intended to be
launched by a runbot cron script.
This commit is contained in:
Christophe Monniez
2018-09-19 15:58:10 +02:00
parent 19e9909557
commit b9ad03ab78
3 changed files with 46 additions and 1 deletions
+1
View File
@@ -17,3 +17,4 @@ from . import test_tax
from . import test_account_move_taxes_edition
from . import test_templates_consistency
from . import test_account_fiscal_year
from . import test_account_all_l10n
@@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
import logging
import odoo
from odoo import api
from odoo.tests.common import SingleTransactionCase
from odoo.tests import tagged
_logger = logging.getLogger(__name__)
@tagged('standard', '-at_install', 'post_install', 'l10nall')
class TestAllL10n(SingleTransactionCase):
""" This test will install all the l10n_* modules.
As the module install is not yet fully transactional, the modules will
remain installed after the test.
"""
@classmethod
def setUpClass(cls):
super(TestAllL10n, cls).setUpClass()
l10n_mods = cls.env['ir.module.module'].search([
('name', 'like', 'l10n%'),
('state', '=', 'uninstalled'),
])
_logger.info("Modules to install: %s" % [x.name for x in l10n_mods])
for mod in l10n_mods:
_logger.info('Installing l10n module %s' % mod.name)
mod.button_immediate_install()
# Now that new modules are installed, we have to reset the environment
api.Environment.reset()
cls.env = api.Environment(cls.cr, odoo.SUPERUSER_ID, {})
def test_all_l10n(self):
coas = self.env['account.chart.template'].search([])
for coa in coas:
cname = 'company_%s' % str(coa.id)
_logger.info('Testing COA: %s (company: %s)' % (coa.name, cname))
comp = self.env['res.company'].create({
'name': cname,
})
self.env.user.company_id = comp
coa.try_loading_for_current_company()
@@ -27,7 +27,7 @@
</record>
<record id="virements_internes_template" model="account.reconcile.model.template">
<field name="chart_template_id" ref="l10nbe_chart_template"/>
<field name="account_id" search="[('code', '=like', obj().env.ref('l10n_be.l10nbe_chart_template').transfer_account_code_prefix + '%')]"/>
<field name="account_id" search="[('code', '=like', obj().env.ref('l10n_be.l10nbe_chart_template').transfer_account_code_prefix + '%'), ('chart_template_id', '=', obj().env.ref('l10n_be.l10nbe_chart_template').id)]"/>
<field name="name">Virements internes</field>
<field name="amount_type">percentage</field>
<field name="amount">100</field>