diff --git a/odoo/service/server.py b/odoo/service/server.py index 6c3d5784794..91506818cfe 100644 --- a/odoo/service/server.py +++ b/odoo/service/server.py @@ -1308,7 +1308,7 @@ def preload_registries(dbnames): _logger.info("Starting post tests") tests_before = registry._assertion_report.testsRun post_install_suite = loader.make_suite(module_names, 'post_install') - if post_install_suite.countTestCases(): + if post_install_suite.has_http_case(): with registry.cursor() as cr: env = odoo.api.Environment(cr, odoo.SUPERUSER_ID, {}) env['ir.qweb']._pregenerate_assets_bundles() diff --git a/odoo/tests/common.py b/odoo/tests/common.py index 13bc150754d..c7eb7268770 100644 --- a/odoo/tests/common.py +++ b/odoo/tests/common.py @@ -320,6 +320,9 @@ class OdooSuite(BackportSuite): with result.collectStats(test_id): super()._tearDownPreviousClass(test, result) + def has_http_case(self): + return self.countTestCases() and any(isinstance(test_case, HttpCase) for test_case in self) + class MetaCase(type): """ Metaclass of test case classes to assign default 'test_tags':