Skip to content

Commit 8764430

Browse files
Richard deMeesterrichard-willdooit
authored andcommitted
Better handling of tests if CoA is not explicit
1 parent 514d22f commit 8764430

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

addons/account/tests/common.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
import time
88
import base64
99
from lxml import etree
10+
import logging
11+
12+
_logger = logging.getLogger(__name__)
1013

1114

1215
class AccountTestInvoicingCommon(TransactionCase):
@@ -35,7 +38,17 @@ def setUpClass(cls, chart_template_ref=None):
3538
chart_template = cls.env.ref(chart_template_ref)
3639
else:
3740
chart_template = cls.env.ref('l10n_generic_coa.configurable_chart_template', raise_if_not_found=False)
41+
if not chart_template:
42+
chart_template = cls.env['account.chart.template'].search([], limit=1)
43+
if chart_template:
44+
_logger.info(
45+
"Generic CoA not found - Using %s" % chart_template.name
46+
)
3847
if not chart_template:
48+
_logger.warning(
49+
"Accounting Tests skipped - %s" %
50+
(chart_template_ref and ('CoA "%s" not found' % chart_template_ref) or 'No template found.',)
51+
)
3952
cls.tearDownClass()
4053
# skipTest raises exception
4154
cls.skipTest(cls, "Accounting Tests skipped because the user's company has no chart of accounts.")

0 commit comments

Comments
 (0)