[Fix] baser_report_desinger: fix the problem of encodestring

lp bug: https://launchpad.net/bugs/697066 fixed

bzr revid: sbh@tinyerp.com-20110106115613-dh4rcqxvqb6031b4
This commit is contained in:
Sbh (OpenERP) 2011-01-06 17:26:13 +05:30
parent dec836ec28
commit 0001c0ad8e
1 changed files with 7 additions and 4 deletions

View File

@ -60,12 +60,15 @@ class report_xml(osv.osv):
def report_get(self, cr, uid, report_id, context=None):
report = self.browse(cr, uid, report_id, context=context)
reload(sys)
sys.setdefaultencoding( "latin-1" )
try:
sxw_data=(report.report_sxw_content).encode("iso-8859-1", "replace")
rml_data= (report.report_rml_content).encode("iso-8859-1", "replace")
except :
pass
return {
'file_type' : report.report_type,
'report_sxw_content': report.report_sxw_content and base64.encodestring(report.report_sxw_content) or False,
'report_rml_content': report.report_rml_content and base64.encodestring(report.report_rml_content) or False
'report_sxw_content': report.report_sxw_content and base64.encodestring(sxw_data) or False,
'report_rml_content': report.report_rml_content and base64.encodestring(rml_data) or False
}
report_xml()