[MIG] report_xml: Migration to 11.0

This commit is contained in:
Enric Tobella
2017-10-05 15:32:11 +02:00
parent 24dedbc75d
commit 1b10c9f366
14 changed files with 101 additions and 95 deletions

View File

@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html).
from . import test_report_xml

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Creu Blanca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl).
from lxml import etree
from odoo.tests import common
@@ -8,17 +8,12 @@ from odoo.tests import common
class TestXmlReport(common.TransactionCase):
def test_xml(self):
report_object = self.env['ir.actions.report.xml']
report_object = self.env['ir.actions.report']
report_name = 'report_xml.demo_report_xml_view'
self.assertEqual(
report_name, report_object._lookup_report(report_name))
report = report_object._get_report_from_name(report_name)
docs = self.env['res.company'].search([], limit=1)
rep = report_object.render_report(
docs.ids, report_name, {}
)
self.assertEqual(report.report_type, 'qweb-xml')
rep = report.render(docs.ids, {})
root = etree.fromstring(rep[0])
el = root.xpath('/root/user/name')
self.assertEqual(
el[0].text,
docs.ensure_one().name
)
self.assertEqual(el[0].text, docs.ensure_one().name)