Availability |
Odoo Online
Odoo.sh
On Premise
|
Lines of code | 786 |
Technical Name |
ai_sql |
License | OPL-1 |
Website | https://www.niyulabs.com |
Versions | 12.0 13.0 14.0 15.0 16.0 17.0 18.0 |
Talk to Your Odoo Database
Ask Questions, Get Odoo SQL queries from plain English and see your data instantly.
What's the difference between this and just asking ChatGPT directly about Odoo SQL?
Three main things
Your Database Context
This module provides the AI with the actual schema structure of YOUR specific Odoo database. ChatGPT alone only has general knowledge so prone to mistakes.
Data Integration
This runs inside Odoo, executes the SQL, and shows you the data immediately. No copy-pasting queries between browser tabs and your database client.
Error Correction Loop
If the SQL fails, it tries to get an AI-assisted correction automatically.
No More Report Bottlenecks
Doing lengthy work for Odoo data you need right now?
Or worse,waiting for someone else to build a report?
THIS MODULE CHANGES THAT
You need a specific data now but building a custom view takes too long, or you don't know how.
Get the SQL, see the data. Move on.
For example: "Show me sales orders from last week for 'Azure Interior' that are still in 'Quotation' state."
Needs to write SQL frequently, but get tired of looking up exact table and column names for every new query.
Speed up your workflow. Grab the generated SQL as a starting point, verify it, adapt it. Faster iterations.
Ask: "products with 'Chair' in the name and their current stock quantity."
Who Needs This? Probably You If You Deal With Odoo Data
If you're digging into Odoo's data, this makes it faster. Simple as that!
- ✨ Developers: Quickly scaffold SQL queries for custom development, test data assumptions.
- 📈 Data Analysts / BI Folks: Generate SQL for ad-hoc analysis, extract specific datasets for external tools.
- 🔍 Technical Power Users: Go beyond standard reports without needing to be an Odoo ORM wizard.
- Consultants: Rapidly explore client data, validate configurations, or demonstrate data relationships.
- 🎯 Anyone Needing Custom Lists Fast: If you find yourself exporting to Excel constantly just to filter/sort in a specific way, try asking first.
What It Does (No Frills):
Natural Language to Odoo SQL
You type a question, it writes the PostgreSQL query for your Odoo database using its understanding of common Odoo table structures.
See Your Data, Instantly
If the SQL is valid, it runs (read-only!) and shows you the results in a clean table, right in Odoo.
Grab the SQL, Or the Data
Copy the generated SQL to use elsewhere, or export the resulting data table directly to Excel.
AI Helps Fix Mistakes
If the first SQL try has an error on execution, the AI takes another shot at correcting it based on the database error, or tells you why it couldn't.
Nerds Corner
For the Technically Curious
Local Schema Analysis
Your Odoo module analyzes your database structure to find the right SQL table and column names related to your question. This specific, local context is key.
AI-Powered SQL Crafting
Your natural language question, Odoo version, and the relevant SQL schema context are sent to a large language model (via your OpenAI key) to generate the SQL.
Direct DB Execution
Generated SELECT queries are run directly against your PostgreSQL database using Odoo's standard cursor. No ORM middleman for the execution itself.
Iterative Correction Loop
If a generated SQL query throws a database error, the error, original query, and schema go back to the AI for a correction attempt.
Client-Side UI (OWL)
A responsive Odoo Web Library (OWL) component handles the user interface for a smooth experience within Odoo.
What's Coming Next?
We're focused on core SQL generation now. Later, we're looking at -
AI Suggested Charts
Automatically suggest and display basic charts (bar, line, pie) based on the queried data.
Cloud Spreadsheet Integration
Direct export/sync to Google Sheets or Excel Online.
Advanced Schema Understanding
Better handling of complex custom models and many-to-many relationships automatically.
Data Privacy / Important Notes:
-
🔑
Your OpenAI Key, Your Control: The module requires YOUR OpenAI API key. All AI processing happens under your OpenAI account, and you are responsible for any associated costs.
-
💰
Data Execution is Local: The generated SQL query runs directly on your Odoo server against your database.
-
🛡
What Gets Sent to AI?
- Your natural language question.
- Snippets of your database's structure. Your actual data records (e.g., customer names, sales amounts) are NOT sent to the AI for generating the SQL query.
- If a generated SQL query fails, the failed SQL and the database error message are sent back to the AI (with the schema) for a correction attempt.
-
🧠
No Niyu Labs Server Involved This module directly uses your Odoo instance and your OpenAI key. We don't see your queries or your data.
Need More? Custom AI for Your Odoo?
If you need Deeper understanding of your specific Odoo customizations. Unique AI-driven workflows or data analysis features for your business. Other AI integrations with Odoo. We build these things.
Connect with Us: info@niyulabs.comFrequently Asked Questions (FAQs):
01 What Odoo versions does this module support?
It's built and tested primarily for Odoo 18. It should also work well with Odoo 15, 16, and 17. If you need support for older Odoo versions, contact us to discuss.
02 What do I actually need to make this work?
An Odoo instance (v15+ ideally) and your own API key from OpenAI (the one you use for ChatGPT Plus or their API platform). That's it.
03 Is my sensitive Odoo data sent to external servers or Niyu Labs?
No, your actual data records (like customer names, sales figures, product details) are NOT sent to any Niyu Labs server. To understand your question, the module sends the text of your question and relevant parts of your database structure.
04 What about pricing? Is this a subscription?
No subscription. You make a one-time purchase for this module from the Odoo App Store. The only ongoing potential cost is your own usage of the OpenAI API, which is billed directly by OpenAI to your OpenAI account based on how many questions you ask and their complexity.
05 Does this always generate perfect SQL? What if the AI gets it wrong?
The AI is very capable, especially with good schema context, but it's not infallible. If it can't understand your question or the schema context isn't clear enough for it to generate SQL, it will usually tell you it failed and give a reason (this will show up in red in the UI). Sometimes, you might need to rephrase your question more clearly.
06 How does this "read-only" SQL query work? Is my data safe from accidental changes?
The module is designed to only instruct the AI to generate SELECT (read-only) SQL queries. We have basic checks to prevent other commands. However, for true peace of mind and best practice on a production system, we strongly recommend your Odoo database administrator configures a dedicated PostgreSQL database user that only has SELECT permissions, and configures Odoo (or this module, if enhanced) to use that specific user for these AI-generated queries. This ensures that even if a rogue query somehow got through, the database itself would block any attempt to modify data.
07 Can it query data from my custom Odoo modules or custom fields?
Yes, to a good extent. The module attempts to send the schema (SQL table and column names) for relevant tables, including custom ones (x_studio_... fields or custom models that are standard PostgreSQL tables). If your custom fields and tables have reasonably descriptive SQL names, the AI can often include them. Highly complex or unusually structured custom data might be more challenging for the AI.
Your Guide to Niyu AI SQL
Quick and easy setup.
Installation
- Place the `ai_sql` module folder into your Odoo custom addons directory.
- Update your Odoo apps list and install "AI SQL Generator".
Configuration
- Go to Odoo Settings -> General Settings. Scroll to "AI SQL Generator Configuration.".
- Enter your OpenAI API Key. Click Save.
How to Use
- Find "AI SQL Generator" in your Odoo menus. Click "Generate SQL".
- Type your question, click "Generate SQL".
- View SQL, see data preview, export to Excel.
Effective Querying
- Be as specific as possible. Include timeframes ("last month", "in 2023").
- Use table/field names if you know them for precision (e.g., "show `name`, `email` from `res_partner` where `country_id` is for Belgium").
Troubleshooting
- "OpenAI API Key not configured/invalid"**: Double-check your key in settings and that it's active with credits in your OpenAI account.
- SQL Execution Error:** The AI's generated SQL might still have a database-level error. The module will attempt one AI correction. If it still fails, the error and the SQL are shown. You may need to adjust your English query or the SQL itself if you're comfortable.
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module