|
|
@ -154,8 +154,14 @@ class Py3oParser(report_sxw): |
|
|
|
|
|
|
|
datadict = parser_instance.localcontext |
|
|
|
|
|
|
|
res = data_struct.render(datadict) |
|
|
|
parsed_datadict = data_struct.render(datadict) |
|
|
|
|
|
|
|
if filetype.fusion_ext == report_xml.py3o_template_id.filetype: |
|
|
|
# No format conversion is needed, render the template directly |
|
|
|
template.render(parsed_datadict) |
|
|
|
res = out_stream.getvalue() |
|
|
|
|
|
|
|
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 |
|
|
@ -175,7 +181,7 @@ class Py3oParser(report_sxw): |
|
|
|
} |
|
|
|
fields = { |
|
|
|
"targetformat": filetype.fusion_ext, |
|
|
|
"datadict": json.dumps(res), |
|
|
|
"datadict": json.dumps(parsed_datadict), |
|
|
|
"image_mapping": "{}", |
|
|
|
} |
|
|
|
r = requests.post(fusion_server.url, data=fields, files=files) |
|
|
@ -197,7 +203,9 @@ class Py3oParser(report_sxw): |
|
|
|
fd.write(chunk) |
|
|
|
fd.seek(0) |
|
|
|
# ... but odoo wants the whole data in memory anyways :) |
|
|
|
return fd.read(), filetype.human_ext |
|
|
|
res = fd.read() |
|
|
|
|
|
|
|
return res, filetype.human_ext |
|
|
|
|
|
|
|
def create(self, cr, uid, ids, data, context=None): |
|
|
|
""" Override this function to handle our py3o report |
|
|
|