From 541cd8b08c8971fb60b8d3cac24889a993e7b73c Mon Sep 17 00:00:00 2001 From: josep-tecnativa Date: Tue, 24 Oct 2023 09:50:21 +0200 Subject: [PATCH] [IMP] report_xml: test performance improvement - Create setUpClass method - Include context keys for avoiding mail operations overhead. --- report_xml/tests/test_report_xml.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/report_xml/tests/test_report_xml.py b/report_xml/tests/test_report_xml.py index b92ed9213..39e1b0c1b 100644 --- a/report_xml/tests/test_report_xml.py +++ b/report_xml/tests/test_report_xml.py @@ -7,6 +7,20 @@ from odoo.tests import common class TestXmlReport(common.TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + # Remove this variable in v16 and put instead: + # from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT + DISABLED_MAIL_CONTEXT = { + "tracking_disable": True, + "mail_create_nolog": True, + "mail_create_nosubscribe": True, + "mail_notrack": True, + "no_reset_password": True, + } + cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT)) + def test_xml(self): report_object = self.env["ir.actions.report"] report_name = "report_xml.demo_report_xml_view"