[FIX] ir_actions: adapt render_report when called in a tests/qweb report context to generate the pdf only if a directory has been provided
This commit is contained in:
parent
58d3a6f3f7
commit
b50421e551
|
@ -41,6 +41,7 @@ import openerp.workflow
|
|||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class actions(osv.osv):
|
||||
_name = 'ir.actions.actions'
|
||||
_table = 'ir_actions'
|
||||
|
@ -129,9 +130,15 @@ class ir_actions_report_xml(osv.osv):
|
|||
Look up a report definition and render the report for the provided IDs.
|
||||
"""
|
||||
new_report = self._lookup_report(cr, name)
|
||||
# in order to use current yml test files with qweb reports
|
||||
if isinstance(new_report, (str, unicode)):
|
||||
return self.pool['report'].get_pdf(cr, uid, res_ids, new_report, data=data, context=context), 'pdf'
|
||||
|
||||
if isinstance(new_report, (str, unicode)): # Qweb report
|
||||
# The only case where a QWeb report is rendered with this method occurs when running
|
||||
# yml tests originally written for RML reports.
|
||||
if openerp.tools.config['test_enable'] and not tools.config['test_report_directory']:
|
||||
# Only generate the pdf when a destination folder has been provided.
|
||||
return self.pool['report'].get_html(cr, uid, res_ids, new_report, data=data, context=context), 'html'
|
||||
else:
|
||||
return self.pool['report'].get_pdf(cr, uid, res_ids, new_report, data=data, context=context), 'pdf'
|
||||
else:
|
||||
return new_report.create(cr, uid, res_ids, data, context)
|
||||
|
||||
|
@ -1170,7 +1177,4 @@ class ir_actions_act_client(osv.osv):
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -87,8 +87,7 @@ def try_report(cr, uid, rname, ids, data=None, context=None, our_module=None, re
|
|||
if ('[[' in line) or ('[ [' in line):
|
||||
_logger.error("Report %s may have bad expression near: \"%s\".", rname, line[80:])
|
||||
# TODO more checks, what else can be a sign of a faulty report?
|
||||
elif res_format == 'foobar':
|
||||
# TODO
|
||||
elif res_format == 'html':
|
||||
pass
|
||||
else:
|
||||
_logger.warning("Report %s produced a \"%s\" chunk, cannot examine it", rname, res_format)
|
||||
|
|
Loading…
Reference in New Issue