Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
1431 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
lug 25
1493
1
mag 25
1469
1
apr 25
2136
0
ott 24
1208
7
set 24
25310