Only use direct rendering as a fallback if no py3o server is defined
--HG-- branch : odoo8pull/80/head
parent
ab49206f72
commit
1826aa2c45
|
@ -19,6 +19,7 @@ class py3o_template(osv.Model):
|
||||||
('ods', u"ODF Spreadsheet"),
|
('ods', u"ODF Spreadsheet"),
|
||||||
],
|
],
|
||||||
u"LibreOffice Template File Type",
|
u"LibreOffice Template File Type",
|
||||||
|
required=True,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -156,20 +156,21 @@ class Py3oParser(report_sxw):
|
||||||
|
|
||||||
parsed_datadict = data_struct.render(datadict)
|
parsed_datadict = data_struct.render(datadict)
|
||||||
|
|
||||||
|
fusion_server_obj = pool.get('py3o.server')
|
||||||
|
fusion_server_ids = fusion_server_obj.search(
|
||||||
|
cr, uid, [], context=context, limit=1
|
||||||
|
)
|
||||||
|
if not fusion_server_ids:
|
||||||
if filetype.fusion_ext == report_xml.py3o_template_id.filetype:
|
if filetype.fusion_ext == report_xml.py3o_template_id.filetype:
|
||||||
# No format conversion is needed, render the template directly
|
# No format conversion is needed, render the template directly
|
||||||
template.render(parsed_datadict)
|
template.render(parsed_datadict)
|
||||||
res = out_stream.getvalue()
|
res = out_stream.getvalue()
|
||||||
|
else:
|
||||||
else: # Call py3o.server to render the template in the desired format
|
|
||||||
fusion_server_obj = pool.get('py3o.server')
|
|
||||||
fusion_server_ids = fusion_server_obj.search(
|
|
||||||
cr, uid, [], context=context
|
|
||||||
)
|
|
||||||
if not fusion_server_ids:
|
|
||||||
raise exceptions.MissingError(
|
raise exceptions.MissingError(
|
||||||
_(u"No Py3o server configuration found")
|
_(u"No Py3o server configuration found")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else: # Call py3o.server to render the template in the desired format
|
||||||
fusion_server_id = fusion_server_ids[0]
|
fusion_server_id = fusion_server_ids[0]
|
||||||
|
|
||||||
fusion_server = fusion_server_obj.browse(
|
fusion_server = fusion_server_obj.browse(
|
||||||
|
|
Loading…
Reference in New Issue