changes for odt reports
bzr revid: dsh@tinyerp.com-20081224112442-ztn3y9qnn98c9g7f
This commit is contained in:
parent
c1c36eedea
commit
b95c0dc2df
|
@ -118,6 +118,7 @@ class report_xml(osv.osv):
|
|||
('html', 'html'),
|
||||
('raw', 'raw'),
|
||||
('sxw', 'sxw'),
|
||||
('odt', 'odt'),
|
||||
], string='Type', required=True),
|
||||
'groups_id': fields.many2many('res.groups', 'res_groups_report_rel', 'uid', 'gid', 'Groups'),
|
||||
'attachment': fields.char('Save As Attachment Prefix', size=32, help='This is the prefix of the file name the print will be saved as attachement. Keep empty to not save the printed reports')
|
||||
|
|
|
@ -81,6 +81,7 @@ class report_rml(report_int):
|
|||
'html': self.create_html,
|
||||
'raw': self.create_raw,
|
||||
'sxw': self.create_sxw,
|
||||
'odt': self.create_odt,
|
||||
}
|
||||
|
||||
def create(self, cr, uid, ids, datas, context):
|
||||
|
@ -206,6 +207,10 @@ class report_rml(report_int):
|
|||
|
||||
def create_sxw(self, path, logo=None, title=None):
|
||||
return path
|
||||
|
||||
def create_odt(self, data, logo=None, title=None):
|
||||
return data
|
||||
|
||||
|
||||
from report_sxw import report_sxw
|
||||
|
||||
|
|
|
@ -295,7 +295,6 @@ class rml_parse(object):
|
|||
if isinstance(text,(str,unicode)):
|
||||
lst = text.split('\n')
|
||||
# lst = str(text).split('\n') # This is also acceptable, isn't it?
|
||||
|
||||
if lst and (not len(lst)):
|
||||
return None
|
||||
nodes = []
|
||||
|
@ -620,7 +619,7 @@ class report_sxw(report_rml):
|
|||
rml = tools.file_open(self.tmpl, subdir=None).read()
|
||||
report_type= data.get('report_type', report_type)
|
||||
|
||||
if report_type == 'sxw' and report_xml:
|
||||
if report_type in ['sxw','odt'] and report_xml:
|
||||
context['parents'] = sxw_parents
|
||||
sxw_io = StringIO.StringIO(report_xml.report_sxw_content)
|
||||
sxw_z = zipfile.ZipFile(sxw_io, mode='r')
|
||||
|
@ -670,7 +669,10 @@ class report_sxw(report_rml):
|
|||
|
||||
if self.header:
|
||||
#Add corporate header/footer
|
||||
rml = tools.file_open('custom/corporate_sxw_header.xml').read()
|
||||
if report_type=='odt':
|
||||
rml = tools.file_open('custom/corporate_odt_header.xml').read()
|
||||
if report_type=='sxw':
|
||||
rml = tools.file_open('custom/corporate_sxw_header.xml').read()
|
||||
rml_parser = self.parser(cr, uid, self.name2, context)
|
||||
rml_parser.parents = sxw_parents
|
||||
rml_parser.tag = sxw_tag
|
||||
|
@ -709,7 +711,6 @@ class report_sxw(report_rml):
|
|||
}, context=context
|
||||
)
|
||||
cr.commit()
|
||||
|
||||
return (pdf, report_type)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue