diff --git a/account_move_template/tests/test_account_move_template_options.py b/account_move_template/tests/test_account_move_template_options.py index 9d8ea3c50e2..15e1c162655 100644 --- a/account_move_template/tests/test_account_move_template_options.py +++ b/account_move_template/tests/test_account_move_template_options.py @@ -2,13 +2,23 @@ # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from odoo import Command from odoo.exceptions import UserError, ValidationError -from odoo.tests.common import Form, TransactionCase +from odoo.tests.common import Form, TransactionCase, tagged +@tagged("-at_install", "post_install") class TestAccountMoveTemplateEnhanced(TransactionCase): @classmethod def setUpClass(cls): super().setUpClass() + if not cls.env.company.chart_template_id: + # Load a CoA if there's none in current company + coa = cls.env.ref("l10n_generic_coa.configurable_chart_template", False) + if not coa: + # Load the first available CoA + coa = cls.env["account.chart.template"].search( + [("visible", "=", True)], limit=1 + ) + coa.try_loading(company=cls.env.company, install_demo=False) cls.Move = cls.env["account.move"] cls.Journal = cls.env["account.journal"] cls.Account = cls.env["account.account"]