From b9ad03ab78f5ba07f99c16dd4bd9a8193a15efca Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Mon, 25 Jun 2018 09:54:22 +0200 Subject: [PATCH] [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. --- addons/account/tests/__init__.py | 1 + addons/account/tests/test_account_all_l10n.py | 44 +++++++++++++++++++ .../data/account_reconcile_model_template.xml | 2 +- 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 addons/account/tests/test_account_all_l10n.py diff --git a/addons/account/tests/__init__.py b/addons/account/tests/__init__.py index d9549c1acb5..1d6d1a3c4d5 100644 --- a/addons/account/tests/__init__.py +++ b/addons/account/tests/__init__.py @@ -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 diff --git a/addons/account/tests/test_account_all_l10n.py b/addons/account/tests/test_account_all_l10n.py new file mode 100644 index 00000000000..6d69c53927a --- /dev/null +++ b/addons/account/tests/test_account_all_l10n.py @@ -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() diff --git a/addons/l10n_be/data/account_reconcile_model_template.xml b/addons/l10n_be/data/account_reconcile_model_template.xml index a79759f9f41..aef848d99dd 100644 --- a/addons/l10n_be/data/account_reconcile_model_template.xml +++ b/addons/l10n_be/data/account_reconcile_model_template.xml @@ -27,7 +27,7 @@ - + Virements internes percentage 100