OCA reporting engine fork for dev and update.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

47 lines
2.2 KiB

# Copyright 2019 Creu Blanca
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import TransactionCase
class TestReportContext(TransactionCase):
def test_report_01(self):
company = self.browse_ref('base.main_company')
report = self.browse_ref('web.action_report_internalpreview')
self.env['ir.config_parameter'].sudo().set_param(
'report.default.context', '{"test_parameter": 1}')
report.write({'context': '{"test_parameter": 2}'})
action = report.with_context(test_parameter=3).report_action(company)
self.assertEqual(3, action['context']['test_parameter'])
def test_report_02(self):
company = self.browse_ref('base.main_company')
report = self.browse_ref('web.action_report_internalpreview')
self.env['ir.config_parameter'].sudo().set_param(
'report.default.context', '{"test_parameter": 1}')
report.write({'context': '{"test_parameter": 2}'})
action = report.report_action(company)
self.assertEqual(2, action['context']['test_parameter'])
def test_report_03(self):
company = self.browse_ref('base.main_company')
report = self.browse_ref('web.action_report_internalpreview')
self.env['ir.config_parameter'].sudo().set_param(
'report.default.context', '{"test_parameter": 1}')
action = report.with_context(test_parameter=3).report_action(company)
self.assertEqual(3, action['context']['test_parameter'])
def test_report_04(self):
company = self.browse_ref('base.main_company')
report = self.browse_ref('web.action_report_internalpreview')
report.write({'context': '{"test_parameter": 2}'})
action = report.report_action(company)
self.assertEqual(2, action['context']['test_parameter'])
def test_report_05(self):
company = self.browse_ref('base.main_company')
report = self.browse_ref('web.action_report_internalpreview')
self.env['ir.config_parameter'].sudo().set_param(
'report.default.context', '{"test_parameter": 1}')
action = report.report_action(company)
self.assertEqual(1, action['context']['test_parameter'])