Hello,
Unfortunately, QWeb reports in Odoo cannot directly connect to external databases using JDBC/ODBC or similar protocols. QWeb is primarily a templating engine that renders data already available within the Odoo environment.
However, there are a couple of ways to achieve your desired outcome:
- Using Odoo Models and Python code:
- The recommended approach is to create an Odoo model that fetches data from the external source using Python code. You can use libraries like psycopg2 for PostgreSQL, or other appropriate libraries for different database types, to connect to the external database.
- Then, you can define methods in your Odoo model to retrieve and process the data.
- Finally, you can pass the data from your Odoo model to the QWeb report for rendering.
- Using Odoo API (RPC calls):
- You can expose an API endpoint in Odoo that fetches data from the external source.
- Your QWeb report can then call this API endpoint to retrieve the data and render it.
While direct JDBC/ODBC connections from QWeb are not possible, these methods allow you to integrate external data into your Odoo reports effectively.