render, render_template, load, activity_schedule_with_view, get_website_pages should all be private: It should not be possible to render an aribtrary template only with its name or id Still need to render some qweb views from js so the method render_template is kept public. This explains why the website editor still need read access on ir.ui.view as we want to allow any snippet to be rendered.
34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
import logging
|
|
|
|
import odoo
|
|
import odoo.tests
|
|
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
@odoo.tests.tagged('post_install', '-at_install')
|
|
class TestReports(odoo.tests.TransactionCase):
|
|
def test_reports(self):
|
|
domain = [('report_type', 'like', 'qweb')]
|
|
for report in self.env['ir.actions.report'].search(domain):
|
|
report_model = 'report.%s' % report.report_name
|
|
try:
|
|
self.env[report_model]
|
|
except KeyError:
|
|
# Only test the generic reports here
|
|
_logger.info("testing report %s", report.report_name)
|
|
report_model = self.env[report.model]
|
|
report_records = report_model.search([], limit=10)
|
|
if not report_records:
|
|
_logger.info("no record found skipping report %s", report.report_name)
|
|
if not report.multi:
|
|
report_records = report_records[:1]
|
|
|
|
# Test report generation
|
|
report._render_qweb_html(report_records.ids)
|
|
else:
|
|
continue
|