[FIX] report_webkit: Re-write yml test into python
An yml import is instantiated in old api style, with old api self and registry. As there are no more api.v7 method in report, rewriting the yml test in python will make the test valid
This commit is contained in:
committed by
Yannick Tivisse
parent
47c67b640b
commit
2681c22089
@@ -68,9 +68,6 @@ TODO:
|
||||
'demo': [
|
||||
"report/webkit_report_demo.xml",
|
||||
],
|
||||
'test': [
|
||||
"test/print.yml",
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
-
|
||||
Print the report_webkit demo report.
|
||||
-
|
||||
!python {model: ir.actions.report.xml}: |
|
||||
import os
|
||||
from openerp import tools
|
||||
from openerp.report import render_report
|
||||
ids = self.pool['ir.actions.report.xml'].search(cr, uid, [], {})
|
||||
data, format = render_report(cr, uid, ids, 'webkit.ir.actions.report.xml', {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'report_webkit_demo_report.'+format), 'wb+').write(data)
|
||||
@@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import test_report_webkit
|
||||
@@ -0,0 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import os
|
||||
import odoo.tests
|
||||
from odoo import tools
|
||||
from odoo.report import render_report
|
||||
|
||||
class TestReportsWebkit(odoo.tests.TransactionCase):
|
||||
|
||||
def test_report_webkit(self):
|
||||
report_ids = self.env['ir.actions.report.xml'].search([]).ids
|
||||
data, format = render_report(self.env.cr, self.env.uid, report_ids, 'webkit.ir.actions.report.xml', {}, context=self.env.context)
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'report_webkit_demo_report.' + format), 'wb+').write(data)
|
||||
@@ -231,7 +231,7 @@ class IrActionsReportXml(models.Model):
|
||||
else:
|
||||
return self.env['report'].get_pdf(res_ids, report, data=data), 'pdf'
|
||||
else:
|
||||
return report.create(data)
|
||||
return report.create(self._cr, self._uid, res_ids, data, context=self._context)
|
||||
|
||||
|
||||
class IrActionsActWindow(models.Model):
|
||||
|
||||
Reference in New Issue
Block a user