commit
a02c220413
|
@ -14,15 +14,26 @@ except ImportError:
|
||||||
|
|
||||||
|
|
||||||
class TestReport(common.TransactionCase):
|
class TestReport(common.TransactionCase):
|
||||||
def setUp(self):
|
@classmethod
|
||||||
super().setUp()
|
def setUpClass(cls):
|
||||||
report_object = self.env["ir.actions.report"]
|
super().setUpClass()
|
||||||
self.xlsx_report = self.env["report.report_xlsx.abstract"].with_context(
|
# 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))
|
||||||
|
report_object = cls.env["ir.actions.report"]
|
||||||
|
cls.xlsx_report = cls.env["report.report_xlsx.abstract"].with_context(
|
||||||
active_model="res.partner"
|
active_model="res.partner"
|
||||||
)
|
)
|
||||||
self.report_name = "report_xlsx.partner_xlsx"
|
cls.report_name = "report_xlsx.partner_xlsx"
|
||||||
self.report = report_object._get_report_from_name(self.report_name)
|
cls.report = report_object._get_report_from_name(cls.report_name)
|
||||||
self.docs = self.env["res.company"].search([], limit=1).partner_id
|
cls.docs = cls.env["res.company"].search([], limit=1).partner_id
|
||||||
|
|
||||||
def test_report(self):
|
def test_report(self):
|
||||||
report = self.report
|
report = self.report
|
||||||
|
|
|
@ -7,20 +7,31 @@ from odoo.tests.common import TransactionCase
|
||||||
|
|
||||||
|
|
||||||
class TestReportXlsxHelper(TransactionCase):
|
class TestReportXlsxHelper(TransactionCase):
|
||||||
def setUp(self):
|
@classmethod
|
||||||
super(TestReportXlsxHelper, self).setUp()
|
def setUpClass(cls):
|
||||||
|
super(TestReportXlsxHelper, cls).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))
|
||||||
today = date.today()
|
today = date.today()
|
||||||
p1 = self.env.ref("base.res_partner_1")
|
p1 = cls.env.ref("base.res_partner_1")
|
||||||
p2 = self.env.ref("base.res_partner_2")
|
p2 = cls.env.ref("base.res_partner_2")
|
||||||
p1.date = today
|
p1.date = today
|
||||||
p2.date = today
|
p2.date = today
|
||||||
self.partners = p1 + p2
|
cls.partners = p1 + p2
|
||||||
ctx = {
|
ctx = {
|
||||||
"report_name": "report_xlsx_helper.test_partner_xlsx",
|
"report_name": "report_xlsx_helper.test_partner_xlsx",
|
||||||
"active_model": "res.partner",
|
"active_model": "res.partner",
|
||||||
"active_ids": self.partners.ids,
|
"active_ids": cls.partners.ids,
|
||||||
}
|
}
|
||||||
self.report = self.env["ir.actions.report"].with_context(**ctx)
|
cls.report = cls.env["ir.actions.report"].with_context(**ctx)
|
||||||
|
|
||||||
def test_report_xlsx_helper(self):
|
def test_report_xlsx_helper(self):
|
||||||
report_xls = self.report._render_xlsx(None, None)
|
report_xls = self.report._render_xlsx(None, None)
|
||||||
|
|
|
@ -7,6 +7,20 @@ from odoo.tests import common
|
||||||
|
|
||||||
|
|
||||||
class TestXmlReport(common.TransactionCase):
|
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):
|
def test_xml(self):
|
||||||
report_object = self.env["ir.actions.report"]
|
report_object = self.env["ir.actions.report"]
|
||||||
report_name = "report_xml.demo_report_xml_view"
|
report_name = "report_xml.demo_report_xml_view"
|
||||||
|
|
Loading…
Reference in New Issue