OdooWiki OCA HUB
Reporting License: AGPL-3

This module extends the functionality of reporting, to support creation of extra custom reports. It allows user to write a custom SQL request. (Generally, admin users)

Once written, a new model is generated, and user can map the selected field with odoo fields. Then user ends the process, creating new menu, action and graph view.

Technically, the module create SQL View (or materialized view, if option is checked). Materialized view duplicates datas, but request are fastest. If materialized view is enabled, this module will create a cron task to refresh the data).

By default, users member of 'SQL Request / User' can see all the views. You can specify extra groups that have the right to access to a specific view.

Warning

This module is intended for technician people in a company and for Odoo integrators.

It requires the user to know SQL syntax and Odoo models.

If you don't have such skills, do not try to use this module specially on a production environment.

Use Cases

this module is interesting for the following use cases

  • You want to realize technical SQL requests, that Odoo framework doesn't allow (For exemple, UNION with many SELECT) A typical use case is if you want to have Sale Orders and PoS Orders datas in a same table
  • You want to customize an Odoo report, removing some useless fields and adding some custom ones. In that case, you can simply select the fields of the original report (sale.report model for exemple), and add your custom fields
  • You have a lot of data, and classical SQL Views have very bad performance. In that case, MATERIALIZED VIEW will be a good solution to reduce display duration

auto_awesome What this module does

AI-generated from the code · Odoo 19.0

Lets technical users build custom reports by writing an SQL query, then automatically creates the database view, an Odoo model, list/form/graph/pivot views, an action and a menu to display the results.

This module adds a new screen called SQL Views where a technician writes a raw SQL query. After validating the query, Odoo reads the resulting columns and creates one line per column, which the user maps to Odoo field types (text, number, date, selection, relation, etc.).

A guided workflow with buttons moves the record through states: Create SQL Elements builds the database view (normal or materialized), the Odoo model, its fields, access rights and an access rule; Create UI then generates the form, list, graph, pivot and search views, the window action and the menu entry. Buttons also allow deleting the UI or the SQL elements, opening the generated view, and refreshing a materialized view.

Business rules shown in the code: indexes can only be created on materialized views; only graph, pivot, list and form are accepted in the view order; many2one fields must have a related model; records can only be deleted while in draft; fields cannot be deleted once the model or UI exists. A materialized view gets a daily scheduled task that refreshes it and updates the action name with the refresh date.

It touches bi.sql.view, bi.sql.view.field, ir.model, ir.model.fields, ir.model.access, ir.rule, ir.ui.view, ir.actions.act_window, ir.ui.menu and ir.cron. Menus appear under the Spreadsheet Dashboard configuration and root menus.

Depends on

spreadsheet_dashboardsql_request_abstract

Menus it adds

menu_bi_sql_viewSQL Reports
Models and fields (2)
  • bi.sql.view · new modelsize (Database Size), query, state, cron_id (Odoo Cron), menu_id (Odoo Menu), rule_id (Odoo Rule), model_id (Odoo Model), sequence (sequence), action_id (Odoo Action), view_name, model_name, view_order, domain_force (Extra Rule Definition), form_view_id (Odoo Form View), tree_view_id (Odoo List View), graph_view_id (Odoo Graph View), pivot_view_id (Odoo Pivot View), action_context, parent_menu_id (Parent Odoo Menu), search_view_id (Odoo Search View), technical_name, is_materialized (Is Materialized View), materialized_text, bi_sql_view_field_ids (SQL Fields), computed_action_context
  • bi.sql.view.field · new modelname, state, ttype (Field Type), is_index, sequence (sequence), sql_type (SQL Type), selection (Selection Options), graph_type, index_name, is_group_by (Is Group by), field_context, bi_sql_view_id (SQL View), group_operator, tree_visibility, field_description, many2one_model_id (Model), is_many2one_clickable

Text generated by AI (DeepSeek) from reading the Odoo 19.0 code on GitHub; it may contain mistakes, so check the code before deciding. The module is very large and only part of the code was read. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 8 confirmed, 1 with no information of 9 versions.

Sources · Odoo 13.0

Confirmed on 2026-11-03 in branch 13.0 of OCA/reporting-engine.

terminal Installation and usage

OCA documentation · Odoo 19.0
  • Go to Dashboard / Configuration / SQL Views
  • tip your SQL request
  • Select the group(s) that could have access to the view

Optionnaly, you can add a domain.

A tipical domain in a multi company context is to write ['|', ('company_id', '=', False), ('company_id', 'in', company_ids)] to make reporting depending on the current companies of the user.

  • Click on the button 'Validate SQL Expression'
  • Once the sql request checked, the module analyses the column of the view, and propose field mapping. For each field, you can decide to create an index and set if it will be displayed on the pivot graph as a column, a row or a measure. On top of that, if the field is of type Many2one, you can also select the option to be clickable on the list view.
  • Click on the button 'Create SQL elements'. (this step could take a while, if view is materialized)
  • If it's a MATERIALIZED view: > - a cron task is created to refresh the view. You can so define the > frequency of the refresh. > - the size of view (and the indexes is displayed)
  • Before applying the final step, you will need to add a specific Parent Menu to use when creating the UI Menu for the report. By default, it will be set with the SQL Views menu, which can be changed before creating the UI elements in order to have the report accessible from a different place within Odoo.
  • Finally, click on 'Create UI', to create new menu, action, graph view and search view.

To use this module, you need to:

  • Go to 'Dashboards \> SQL Reports'
  • Select the desired report

>

  • You can switch to 'Graph' or 'tree' views as any report.

No verified information in OCA: Installation.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.