تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
689 أدوات العرض

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
مايو 25
519
1
أبريل 25
1634
0
أبريل 25
788
0
أكتوبر 24
624
7
سبتمبر 24
24166