JayVora-SerpentCS / Jasperreports_odoo

Jasper Reports Engine for Odoo
http://www.serpentcs.com
81 stars 144 forks source link

Example to call and send custom data to jasper (odoo v12) #127

Closed samsagaz closed 3 years ago

samsagaz commented 3 years ago

Hi, someone have some example about how to send custom data to jasper report in odoo v12?

Im trying to parse some data from wizard without luck

Following the documentation example i get the following error when use parameters

File "/usr/lib/python3.6/json/__init__.py", line 348, in loads 'not {!r}'.format(s.__class__.__name__)) TypeError: the JSON object must be str, bytes or bytearray, not 'dict'

and if i use json.dump()

report_dic = { 'type': 'ir.actions.report', 'data': json.dumps(data), 'context': context, 'report_name': report.report_name, 'report_type': report.report_type, }

i get the following:

Report error Traceback (most recent call last): File "/home/samsagaz/Documents/Programming/PythonEynes/dpisa12-stage/addons/eynes/l10n-argentina/subjournal_report_xls/controllers/main.py", line 19, in report_routes reportname, docids, converter, **data File "/home/samsagaz/Documents/Programming/PythonEynes/dpisa12-stage/odoo/odoo/http.py", line 519, in response_wrap response = f(*args, **kw) File "/home/samsagaz/Documents/Programming/PythonEynes/dpisa12-stage/addons/JayVora-SerpentCS/jasper_reports/jasper_reports/controllers/main.py", line 47, in report_routes data.update(json.loads(data.pop('options'))) ValueError: dictionary update sequence element #0 has length 1; 2 is required