How to use html_report module

Hey, I’m trying to work on customized reports, can you help me with html_report module?
from where can I install this? how can I use it?

You can find html_report here but it changed substantially recently and we no longer support jinja but use plain python with Dominate to generate reports now. You can find many examples in the module itself.

Simply ask if you have any questions.

I’m using docker for tryton’s setup, and I’m trying to install the html_report module from dockerfile.

RUN pip install git+https://github.com/NaN-tic/trytond-html_report.git@7.8 --break-system-packages


but it is not showing up in modules.

We don’t actually use/support installation via pip, we just clone the repository in modules directory.

Since the GitHub repository doesn’t explain much about how to use it. This is the best approche create an .html file and them reference.

<field name="report">akademy_classe/reports/classes.html</field>
<field name="extension">pdf</field>

But how will I use the fields in html to create report from them?

can you explain the implementation in a bit more detail?

This is no longer supported since version 7.6

is there any documentation or something to use this way?

IMHO an example is better than anything else. Just take a look at prodution.xml on how to register the report and at production.py on how to implement it.

You must inherit DominateReport and in a minimal version inherit the body method where you must return the HTML you want in the body using a dominate object. You can also override the footer, the header or css methods you can find in DominateReport class.

But as said, just to start just clone production.xmland inherit DominateReport overriding the body method, and that should allow you to start with a simple report.

No. You need to know git, clone the repository on the branch you intend to work on, and copy the content inside the modules repository you’re working on.

You may also download the module code as zip and extract on the modules path from your server. Just make sure the resulting directory is named html_report and that you use the same branch as your server series. That will allow you to download the module without git

I just cloned the repository in the modules folder and tried to update the database but it gives an error:
ModuleNotFoundError: No module named ‘jinja2’

You should run pip install jinja2

I am running into an issue where engine.py throws a ModuleNotFoundError.To resolve this, I have been modifying my Dockerfile to install the missing modules individually using separate pip install commands. However, once I install a module and resolve the initial error, the build simply fails again on the very next import statement.

Am I supposed to install every single module individually this way, or is there a better approach for installing all the required modules at once?

image

Also, widgets and xgettext is mentioned as well in the tryton.cfg file which I don’t find in this repo.

Yes, you need to install all the dependencies. Including the ‘xgettext’ and ‘widgets’ modules (those should be cloned just like html_report).

Thanks for the help! It worked.

It will be good then to remove the setup.py.
Or ideally to update it to match the cookiecutter version from the tryton repository.

Also there is a tox.ini that is using the broken setup.py.