From 11e102cef611cf5c770628bb728b41db59b23b3e Mon Sep 17 00:00:00 2001 From: Dhara Shah Date: Wed, 24 Dec 2008 18:00:41 +0530 Subject: [PATCH] small modification bzr revid: dsh@tinyerp.com-20081224123041-4mpney2ca8c83p12 --- .../base_report_designer.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/addons/base_report_designer/base_report_designer.py b/addons/base_report_designer/base_report_designer.py index bf4c26fd4de..6f3c4019934 100644 --- a/addons/base_report_designer/base_report_designer.py +++ b/addons/base_report_designer/base_report_designer.py @@ -31,13 +31,18 @@ import tools class report_xml(osv.osv): _inherit = 'ir.actions.report.xml' - def sxwtorml(self,cr, uid, file_sxw): + def sxwtorml(self,cr, uid, file_sxw,file_type): ''' The use of this function is to get rml file from sxw file. ''' sxwval = StringIO(base64.decodestring(file_sxw)) - fp = tools.file_open('normalized_odt2rml.xsl', - subdir='/home/dsh/my-work/bazaar/odt-sxw2ml') + if file_type=='sxw': + fp = tools.file_open('normalized_oo2rml.xsl', + subdir='addons/base_report_designer/wizard/tiny_sxw2rml') + if file_type=='odt': + fp = tools.file_open('normalized_odt2rml.xsl', + subdir='addons/base_report_designer/wizard/tiny_sxw2rml') + return {'report_rml_content': str(sxw2rml(sxwval, xsl=fp.read()))} def upload_report(self, cr, uid, report_id, file_sxw,file_type, context): @@ -46,11 +51,12 @@ class report_xml(osv.osv): ''' pool = pooler.get_pool(cr.dbname) sxwval = StringIO(base64.decodestring(file_sxw)) - fp = tools.file_open('normalized_oo2rml.xsl', - subdir='addons/base_report_designer/wizard/tiny_sxw2rml') + if file_type=='sxw': + fp = tools.file_open('normalized_oo2rml.xsl', + subdir='addons/base_report_designer/wizard/tiny_sxw2rml') if file_type=='odt': fp = tools.file_open('normalized_odt2rml.xsl', - subdir='/home/dsh/my-work/bazaar/odt-sxw2ml') + subdir='addons/base_report_designer/wizard/tiny_sxw2rml') report = pool.get('ir.actions.report.xml').write(cr, uid, [report_id], { 'report_sxw_content': base64.decodestring(file_sxw), 'report_rml_content': str(sxw2rml(sxwval, xsl=fp.read())),