[HACK] report: return html when a pdf is requested with a test cursor

This commit is contained in:
Simon Lejeune
2015-09-28 14:32:31 +02:00
parent c02ff8aebd
commit 0e304bf77e
+8
View File
@@ -5,6 +5,7 @@ from openerp import api
from openerp import SUPERUSER_ID
from openerp.exceptions import AccessError
from openerp.osv import osv, fields
from openerp.sql_db import TestCursor
from openerp.tools import config
from openerp.tools.misc import find_in_path
from openerp.tools.translate import _
@@ -143,6 +144,13 @@ class Report(osv.Model):
if html is None:
html = self.get_html(cr, uid, ids, report_name, data=data, context=context)
# The test cursor prevents the use of another environnment while the current
# transaction is not finished, leading to a deadlock when the report requests
# an asset bundle during the execution of test scenarios. In this case, return
# the html version.
if isinstance(cr, TestCursor):
return html
html = html.decode('utf-8') # Ensure the current document is utf-8 encoded.
# Get the ir.actions.report.xml record we are working on.