From 6a6084c41dfa6fdb794faec45a8e43e04d15c049 Mon Sep 17 00:00:00 2001 From: Bhavesh Odedra Date: Mon, 13 Apr 2020 12:54:05 +0530 Subject: [PATCH] [ADD] test cases --- report_batch/__manifest__.py | 2 +- report_batch/models/ir_action_report.py | 6 ----- report_batch/readme/ROADMAP.rst | 0 report_batch/tests/__init__.py | 5 ++++ report_batch/tests/test_report_batch.py | 36 +++++++++++++++++++++++++ 5 files changed, 42 insertions(+), 7 deletions(-) delete mode 100644 report_batch/readme/ROADMAP.rst create mode 100644 report_batch/tests/__init__.py create mode 100644 report_batch/tests/test_report_batch.py diff --git a/report_batch/__manifest__.py b/report_batch/__manifest__.py index 87f77b724..dd191a7a9 100644 --- a/report_batch/__manifest__.py +++ b/report_batch/__manifest__.py @@ -9,7 +9,7 @@ "license": "AGPL-3", "author": "Open Source Integrators, Odoo Community Association (OCA)", "category": "Reporting", - "website": "http://www.opensourceintegrators.com", + "website": "https://github.com/OCA/reporting-engine", "depends": ["stock"], "data": ["security/ir.model.access.csv", "views/ir_action_report_view.xml"], "installable": True, diff --git a/report_batch/models/ir_action_report.py b/report_batch/models/ir_action_report.py index 7945e988a..710f3e3ec 100644 --- a/report_batch/models/ir_action_report.py +++ b/report_batch/models/ir_action_report.py @@ -24,12 +24,6 @@ class IrActionsReport(models.Model): _inherit = "ir.actions.report" subreport_ids = fields.One2many("ir.actions.report.subreport", "parent_report_id") - model_id = fields.Many2one("ir.model", string="Model") - - @api.onchange("model_id") - def onchange_model_id(self): - if self.model_id: - self.model = self.model_id.model def generate_top_part(self): return ( diff --git a/report_batch/readme/ROADMAP.rst b/report_batch/readme/ROADMAP.rst deleted file mode 100644 index e69de29bb..000000000 diff --git a/report_batch/tests/__init__.py b/report_batch/tests/__init__.py new file mode 100644 index 000000000..b3bef7e31 --- /dev/null +++ b/report_batch/tests/__init__.py @@ -0,0 +1,5 @@ +# Copyright (C) 2020 IBM Corp. +# Copyright (C) 2020 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_report_batch diff --git a/report_batch/tests/test_report_batch.py b/report_batch/tests/test_report_batch.py new file mode 100644 index 000000000..ee9a9f437 --- /dev/null +++ b/report_batch/tests/test_report_batch.py @@ -0,0 +1,36 @@ +# Copyright (C) 2019 IBM Corp. +# Copyright (C) 2019 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import odoo.tests.common as test_common + + +class TestReportBatch(test_common.SingleTransactionCase): + def setUp(self): + super(TestReportBatch, self).setUp() + self.report_picking_operations = self.env.ref("stock.action_report_picking") + self.report_deliveryslip = self.env.ref("stock.report_deliveryslip") + + def test_report_batch(self): + report_batch = self.env["ir.actions.report"].create( + { + "name": "Batch Report", + "report_type": "qweb-pdf", + "model": "stock.picking", + "report_name": "my_custom_batch_report", + } + ) + report_batch.write( + { + "subreport_ids": [ + ( + 6, + 0, + [ + self.report_picking_operations.id, + self.report_deliveryslip.id, + ], + ) + ] + } + )