[ADD] test cases
parent
57a1916a20
commit
6a6084c41d
|
@ -9,7 +9,7 @@
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"author": "Open Source Integrators, Odoo Community Association (OCA)",
|
"author": "Open Source Integrators, Odoo Community Association (OCA)",
|
||||||
"category": "Reporting",
|
"category": "Reporting",
|
||||||
"website": "http://www.opensourceintegrators.com",
|
"website": "https://github.com/OCA/reporting-engine",
|
||||||
"depends": ["stock"],
|
"depends": ["stock"],
|
||||||
"data": ["security/ir.model.access.csv", "views/ir_action_report_view.xml"],
|
"data": ["security/ir.model.access.csv", "views/ir_action_report_view.xml"],
|
||||||
"installable": True,
|
"installable": True,
|
||||||
|
|
|
@ -24,12 +24,6 @@ class IrActionsReport(models.Model):
|
||||||
_inherit = "ir.actions.report"
|
_inherit = "ir.actions.report"
|
||||||
|
|
||||||
subreport_ids = fields.One2many("ir.actions.report.subreport", "parent_report_id")
|
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):
|
def generate_top_part(self):
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -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
|
|
@ -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,
|
||||||
|
],
|
||||||
|
)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
Loading…
Reference in New Issue