New report module jasper report tryton

Hello, I have installed the module “tryton-jasper_reports” and “trytond-account_jasper_reports” and they work correctly. I have created a new report of the party.party model and I have the following error when executing it, any clue as to why?

Traceback (most recent call last):
  File "/usr/local/lib/python39/dist-packages/trytond/wsgipy", line 117, in dispatch_request
    return endpoint(request, **requestview_args)
  File "/usr/local/lib/python39/dist-packages/trytond/protocols/dispatcherpy", line 47, in rpc
    return methodsget(requestrpc_method, _dispatch)(
  File "/usr/local/lib/python39/dist-packages/trytond/wsgipy", line 84, in auth_required
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python39/dist-packages/trytond/protocols/wrapperspy", line 159, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/usr/local/lib/python39/dist-packages/trytond/protocols/dispatcherpy", line 181, in _dispatch
    result = rpcresult(meth(*c_args, **c_kwargs))
  File "/usr/local/lib/python39/dist-packages/trytond/report/reportpy", line 219, in execute
    oext, content = cls_execute(
  File "/usr/local/lib/python39/dist-packages/trytond/report/reportpy", line 236, in _execute
    return clsconvert(action, clsrender(action, report_context))
  File "/usr/local/lib/python39/dist-packages/trytond/report/reportpy", line 327, in render
    mimetype = MIMETYPES[reporttemplate_extension]
KeyError: 'jrxml'

Thanks

These are not standard modules, you should report the problem to the author.

upss sorry. I thought that you could comment on all the modules. As there were more comments regarding jasper.

You can but there very few chance that someone can answer (except if the author is following here).

IIRC the jasper reports module requires that you register a report in the pool to enable that jasper conversion. This is legacy code as with register_mixin is now possible to override the behaviour of all reports in the pool.

Why are you using account_jasper_reports? IIRC All the reports included there are available in the standard tryton modules.

I have only tried account_jasper_reports to see how it worked.

Study the report creation options in Tryto, odft, jaspert, etc.
to create custom for the custom module I want to build.

The error shown is when executing a new report created with the jaspert extension.

I see that it is not possible to create a jasper report as it is done in with odt. You have to create a class in a module with for each new report.

Regarding register_mixin, I don’t understand what you’re saying

register_mixin is the way to avoid such requirement. But the module has not been updated to use the new features included on tryton. This is one of the reasons that I will not recomend using external modules but collobarate on improving the standard ones.

1 Like

Exactly.

As Sergi said if jasper_reports used register_mixin it would not be necessary to declare a class for each report.

You can see how it is used in the html_report, which is newer and does use this feature:

https://github.com/NaN-tic/trytond-html_report/blob/main/init.py#L30

If you want to propose a patch for jasper_reports that uses register_mixin it would probably be accepted.

We’re not implementing it because we’re moving away from jasper_reports, although it will be available and maintained in newer versions for quite some time.

thanks for the comments. I don’t have a level yet to propose a patch …