Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
1638 Zobrazení

Hello There,

We are building reports using QWeb within Odoo 17.

Objective is connect to external datasource directly from QWeb and render the results within Odoo.

What is the best way to achieve the outcome?

Can Odoo QWeb link to other sources? is it via API or any RPC calls or can it be direct JDBC/ODBC?

Please assist

Thanks

Team Odoo

Avatar
Zrušit
Nejlepší odpověď

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:

  1. 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.
  2. 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.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
čvc 25
1799
1
kvě 25
1888
1
dub 25
2349
0
říj 24
1431
7
zář 24
25790