Repository
OCA/reporting-engine · module folder · Try on Runboat
Module version
2.0.1
Category
Reporting
Folder size
2.01 MB
License
AGPL-3
Application
No
Auto-installable
No
Website
https://github.com/OCA/reporting-engine
Last tracking update
2026-08-07 09:06:34
Authors
Odoo Community Association (OCA), GRAP
Maintainers
Odoo Community Association (OCA), GRAP
Committers
Jesús Alan Ramos Rodríguez, Baptiste Pellarin, Weblate, Franco Leyes, OCA-git-bot, oca-ci
Odoo dependencies
Python dependencies
None
System dependencies
None
Required by
None
Description
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

Code Analysis

Views touched (2)
XML IDNameModelTypeStatus
view_bi_sql_view_form bi.sql.view form Inherits sql_request_abstract.view_sql_request_mixin_form
view_bi_sql_view_tree bi.sql.view tree Inherits sql_request_abstract.view_sql_request_mixin_tree
HTTP endpoints (0)

No HTTP endpoints found for this module.

Models touched (3)

New fields (25)
  • action_context Text
    default='{}' help='Define here a context that will be used by default, when creating the action.'
  • action_id Many2one → ir.actions.act_window
    comodel_name='ir.actions.act_window' string='Odoo Action'
  • bi_sql_view_field_ids One2many → bi.sql.view.field
    comodel_name='bi.sql.view.field' inverse_name='bi_sql_view_id' string='SQL Fields'
  • computed_action_context Text
    compute='_compute_computed_action_context'
  • cron_id Many2one → ir.cron
    comodel_name='ir.cron' copy=False help='Cron Task that will refresh the materialized view' ondelete='cascade' string='Odoo Cron'
  • domain_force Text
    default='[]' help="Define here access restriction to data.\n Take care to use field name prefixed by 'x_'. A global 'ir.rule' will be created. A typical Multi Company rule is for exemple \n ['|', ('x_company_id','child_of', [user.company_id.id]),('x_company_id','=',False)]." string='Extra Rule Definition'
  • form_view_id Many2one → ir.ui.view
    comodel_name='ir.ui.view' string='Odoo Form View'
  • graph_view_id Many2one → ir.ui.view
    comodel_name='ir.ui.view' string='Odoo Graph View'
  • is_materialized Boolean
    default=True string='Is Materialized View'
  • materialized_text Char
    compute='_compute_materialized_text' store=True
  • menu_id Many2one → ir.ui.menu
    comodel_name='ir.ui.menu' string='Odoo Menu'
  • model_id Many2one → ir.model
    comodel_name='ir.model' string='Odoo Model'
  • model_name Char
    compute='_compute_model_name' help='Full Qualified Name of the transient model that will be created.' store=True
  • parent_menu_id Many2one → ir.ui.menu
    comodel_name='ir.ui.menu' default=<expr> help="By assigning a value to this field before manually creating the UI, you're overwriting the parent menu on which the menu related to the SQL report will be created." required=True string='Parent Odoo Menu'
  • pivot_view_id Many2one → ir.ui.view
    comodel_name='ir.ui.view' string='Odoo Pivot View'
  • query Text
    default='SELECT\n my_field as x_my_field\nFROM my_table' help="SQL Request that will be inserted as the view. Take care to :\n * set a name for all your selected fields, specially if you use SQL function (like EXTRACT, ...);\n * Do not use 'SELECT *' or 'SELECT table.*';\n * prefix the name of the selectable columns by 'x_';"
  • rule_id Many2one → ir.rule
    comodel_name='ir.rule' string='Odoo Rule'
  • search_view_id Many2one → ir.ui.view
    comodel_name='ir.ui.view' string='Odoo Search View'
  • sequence Integer
    string='sequence'
  • size Char
    help='Size of the materialized view and its indexes' string='Database Size'
  • state Selection
    selection_add=_STATE_SQL_EDITOR
  • technical_name Char
    help="Suffix of the SQL view. SQL full name will be computed and prefixed by 'x_bi_sql_view_'. Syntax should follow: https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS" required=True
  • tree_view_id Many2one → ir.ui.view
    comodel_name='ir.ui.view' string='Odoo List View'
  • view_name Char
    compute='_compute_view_name' help='Full name of the SQL view' store=True
  • view_order Char
    default='pivot,graph,list' help='Comma-separated text. Possible values: "graph", "pivot", "list" or "form"' required=True
Public methods (12)
  • button_create_sql_view_and_model(self)
  • button_create_ui(self)
  • button_open_view(self)
  • button_preview_sql_expression(self)
  • button_refresh_materialized_view(self)
  • button_reset_to_model_valid(self)
  • button_reset_to_sql_valid(self)
  • button_set_draft(self)
  • button_update_model_access(self)
  • check_manual_fields(self, model)
  • copy(self, default=None)
  • write(self, vals)

New fields (17)
  • bi_sql_view_id Many2one → bi.sql.view
    comodel_name='bi.sql.view' ondelete='cascade' string='SQL View'
  • field_context Char
    default='{}' help='Context value that will be inserted for this field in all the views. Important note : please write a context with single quote.'
  • field_description Char
    help='This will be used as the name of the Odoo field, displayed for users' required=True translate=True
  • graph_type Selection
    selection=_GRAPH_TYPE_SELECTION
  • group_operator Selection
    help='By default, Odoo will sum the values when grouping. If you wish to alter the behaviour, choose an alternate Group Operator' selection=_GROUP_OPERATOR_SELECTION
  • index_name Char
    compute='_compute_index_name'
  • is_group_by Boolean
    help="Check this box if you want to create a 'group by' option in the search view" string='Is Group by'
  • is_index Boolean
    help='Check this box if you want to create an index on that field. This is recommended for searchable and groupable fields, to reduce duration'
  • is_many2one_clickable Boolean
    default=False help='If the field is of type Many2one and the option is enabled, the field will be clickable on the list view.'
  • many2one_model_id Many2one → ir.model
    comodel_name='ir.model' help="For 'Many2one' Odoo field.\n Comodel of the field." string='Model'
  • name Char
    readonly=True required=True
  • selection Text
    default='[]' help="For 'Selection' Odoo field.\n List of options, specified as a Python expression defining a list of (key, label) pairs. For example: [('blue','Blue'), ('yellow','Yellow')]" string='Selection Options'
  • sequence Integer
    readonly=True required=True string='sequence'
  • sql_type Char
    help='SQL Type in the database' readonly=True required=True string='SQL Type'
  • state Selection
    related='bi_sql_view_id.state' store=True
  • tree_visibility Selection
    default='available' required=True selection=_TREE_VISIBILITY_SELECTION
  • ttype Selection
    help="Type of the Odoo field that will be created. Keep empty if you don't want to create a new field. If empty, this field will not be displayed neither available for search or group by function" selection=_TTYPE_SELECTION string='Field Type'
Public methods (1)
  • create(self, vals_list)
    @api.model_create_multi

New fields (0)

No new fields.

Public methods (0)

No public methods.

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…