コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
1052 ビュー

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

アバター
破棄
最善の回答

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.

アバター
破棄
関連投稿 返信 ビュー 活動
1
5月 25
941
1
4月 25
1851
0
4月 25
1107
0
10月 24
986
7
9月 24
24722