Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
86e4d12
new module bi_sql_editor [IMP] function to guess model for many2one f…
legalsylvain Mar 27, 2017
ca42589
OCA Transbot updated translations from Transifex
oca-transbot Jun 3, 2017
8aa3fa3
bi_sql_editor
nicomacr Jul 11, 2017
6f1f1dd
create ui now create tree view [IMP] fr translation [IMP] add last re…
legalsylvain Jul 14, 2017
97dd044
[IMP] Add test + several fixes
AaronHForgeFlow Jul 17, 2017
dcb0027
OCA Transbot updated translations from Transifex
oca-transbot Aug 19, 2017
193092b
FIX bi_sql_editor
nicomacr Aug 14, 2017
b69d2cd
[MIG] bi_sql_editor v10
serpentcs-dev1 Sep 4, 2017
2500c7d
[IMP] preview button
serpentcs-dev1 Oct 3, 2017
4c4f50e
Fix several issues
Apr 13, 2018
e92a431
10.0 imp bi sql editor (#1)
legalsylvain Jul 23, 2018
2dac147
[UPD] Update bi_sql_editor.pot
oca-travis Jul 24, 2018
c7f736d
[MIG] bi_sql_editor: Migration to 11.0
HviorForgeFlow Jul 25, 2018
c2e3a69
[FIX] Can be upgraded with materialized views generated
HviorForgeFlow Aug 28, 2018
722395b
[FIX] ir.cron relation
MiquelRForgeFlow Aug 31, 2018
e7845bd
[IMP] remove unneeded parenthesis
MiquelRForgeFlow Sep 3, 2018
59e90e9
[FIX] Solves the upgrading problem
MiquelRForgeFlow Sep 4, 2018
98f11d5
[FIX] Query and technical name should only be modifiable in draft mode
MiquelRForgeFlow Sep 6, 2018
adf895a
[UPD] Update bi_sql_editor.pot
oca-travis Sep 19, 2018
1b8001b
Update translation files
oca-transbot Dec 9, 2018
ff08ba0
[12.0][MIG] Migrate module bi_sql_editor to v12
AdriaGForgeFlow Dec 14, 2018
7c9c973
[FIX] bi_sql_editor: add in readme how to solve the update all break
MiquelRForgeFlow Jan 15, 2019
21956c5
Update readme
AdriaGForgeFlow Jan 16, 2019
b1dee84
bi_sql_editor 12.0.1.2.0
OCA-git-bot Mar 8, 2019
8a644f9
Update translation files
oca-transbot Mar 17, 2019
877f193
Translated using Weblate (German)
rschnapka Apr 24, 2019
3615b6f
[FIX] bi_sql_editor: Fixes images path
pedrobaeza Jul 26, 2019
d26b7c2
[FIX] bi_sql_editor: Add required attribute name on filters
HviorForgeFlow Sep 13, 2019
682666d
change SQL mapping for date
HviorForgeFlow Sep 23, 2019
40cce38
[ADD] action context
legalsylvain Mar 18, 2020
853ec77
Update translation files
oca-transbot Mar 28, 2020
edb533e
[WIP] imp bi_sql_editor
legalsylvain Jun 18, 2020
02ca14a
[FIX] bi_sql_editor : handle correctly translation for action name
legalsylvain Nov 12, 2020
680bfdf
[IMP] bi_sql_editor : conserve cron settings, when setting materiali…
legalsylvain Jun 7, 2021
3c72280
[IMP] bi_sql_editor: black, isort, prettier
HviorForgeFlow Apr 15, 2020
46eea39
[MIG] bi_sql_editor: Migration to 13.0
HviorForgeFlow Apr 15, 2020
a212b3d
bi_sql_editor 13.0.1.0.1
OCA-git-bot May 26, 2020
94d7404
Translated using Weblate (Spanish)
anasuarez1 Mar 9, 2021
7536779
[IMP] bi_sql_editor: black, isort, prettier
davejames Jun 7, 2021
24ae610
bi_sql_editor: Migration to 14.0
davejames Jun 8, 2021
02807d7
bi_sql_editor: add support for group operators
davejames Jun 7, 2021
ce4aafc
[UPD] Update bi_sql_editor.pot
oca-travis Jun 11, 2021
e54cce2
[UPD] README.rst
OCA-git-bot Jun 11, 2021
899ff80
[IMP] bi_sql_editor: black, isort, prettier
mariadforgeflow Dec 13, 2021
b58ab66
[MIG] bi_sql_editor: Migration to 15.0
mariadforgeflow Dec 13, 2021
23731f5
[UPD] Update bi_sql_editor.pot
Jan 24, 2022
dd45fbc
[UPD] README.rst
OCA-git-bot Jan 24, 2022
7b9ea27
[FIX] bi_sql_editor: fix typo
mariadforgeflow Feb 1, 2022
018714d
bi_sql_editor 15.0.1.0.1
OCA-git-bot Feb 1, 2022
7e82707
[IMP] bi_sql_editor: Remove useless monkeypatch
lmignon Mar 16, 2022
63ae51d
bi_sql_editor 15.0.1.0.2
OCA-git-bot Mar 16, 2022
29eb237
Translated using Weblate (Catalan)
pablontura Apr 22, 2022
df90699
Translated using Weblate (Catalan)
jabelchi Jun 15, 2022
d62f47f
[IMP] bi_sql_editor: black, isort, prettier
legalsylvain Oct 25, 2022
6be6f7d
[MIG] bi_sql_editor : from 15.0 to 16.0
legalsylvain Oct 25, 2022
edecab1
[IMP] bi_sql_editor manual field check performance
paulius-sladkevicius Nov 16, 2022
c55dc6f
[IMP] bi_sql_editor : add field context
legalsylvain Dec 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 198 additions & 0 deletions bi_sql_editor/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
=============
BI SQL Editor
=============

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github
:target: https://github.com/OCA/reporting-engine/tree/15.0/bi_sql_editor
:alt: OCA/reporting-engine
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/reporting-engine-15-0/reporting-engine-15-0-bi_sql_editor
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/143/15.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

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

**Table of contents**

.. contents::
:local:

Installation
============

* You must put this module as `server_wide_modules` in your odoo configuration file
or add '--load=bi_sql_editor' if you start odoo in command line.

Configuration
=============

To configure this module, you need to:

* Go to Settings / Technical / Database Structure / SQL Views

* tip your SQL request

.. figure:: https://raw.githubusercontent.com/OCA/reporting-engine/15.0/bi_sql_editor/static/description/01_sql_request.png
:width: 800 px

* Select the group(s) that could have access to the view

.. figure:: https://raw.githubusercontent.com/OCA/reporting-engine/15.0/bi_sql_editor/static/description/02_security_access.png
:width: 800 px

* Click on the button 'Clean and Check Request'

* 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.

.. figure:: https://raw.githubusercontent.com/OCA/reporting-engine/15.0/bi_sql_editor/static/description/03_field_mapping.png
:width: 800 px

* Click on the button 'Create SQL View, Indexes and Models'. (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)

.. figure:: https://raw.githubusercontent.com/OCA/reporting-engine/15.0/bi_sql_editor/static/description/04_materialized_view_setting.png
:width: 800 px

* Finally, click on 'Create UI', to create new menu, action, graph view and
search view.

Usage
=====

To use this module, you need to:

#. Go to 'Reporting' / 'Custom Reports'

#. Select the desired report

.. figure:: https://raw.githubusercontent.com/OCA/reporting-engine/15.0/bi_sql_editor/static/description/05_reporting_pivot.png
:width: 800 px

* You can switch to 'Pie' chart or 'Line Chart' as any report,

.. figure:: https://raw.githubusercontent.com/OCA/reporting-engine/15.0/bi_sql_editor/static/description/05_reporting_pie.png
:width: 800 px

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/reporting-engine/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20bi_sql_editor%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* GRAP

Contributors
~~~~~~~~~~~~

* Sylvain LE GAL (https://twitter.com/legalsylvain)
* Richard deMeester, WilldooIT (http://www.willdooit.com/)
* David James, WilldooIT (http://www.willdooit.com/)

* This module is highly inspired by the work of
* Onestein: (http://www.onestein.nl/)
Module: OCA/server-tools/bi_view_editor.
Link: https://github.com/OCA/reporting-engine/tree/9.0/bi_view_editor
* Anybox: (https://anybox.fr/)
Module : OCA/server-tools/materialized_sql_view
link: https://github.com/OCA/server-tools/pull/110
* GRAP, Groupement Régional Alimentaire de Proximité: (http://www.grap.coop/)
Module: grap/odoo-addons-misc/pos_sale_reporting
link: https://github.com/grap/odoo-addons-misc/tree/7.0/pos_sale_reporting

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-legalsylvain| image:: https://github.com/legalsylvain.png?size=40px
:target: https://github.com/legalsylvain
:alt: legalsylvain

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-legalsylvain|

This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/15.0/bi_sql_editor>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions bi_sql_editor/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models
from .hooks import uninstall_hook
25 changes: 25 additions & 0 deletions bi_sql_editor/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (C) 2017 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "BI SQL Editor",
"summary": "BI Views builder, based on Materialized or Normal SQL Views",
"version": "16.0.1.0.2",
"license": "AGPL-3",
"category": "Reporting",
"author": "GRAP,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/reporting-engine",
"depends": [
"spreadsheet_dashboard",
"sql_request_abstract",
],
"data": [
"security/ir.model.access.csv",
"views/view_bi_sql_view.xml",
],
"demo": ["demo/res_groups_demo.xml", "demo/bi_sql_view_demo.xml"],
"installable": True,
"uninstall_hook": "uninstall_hook",
"maintainers": ["legalsylvain"],
}
67 changes: 67 additions & 0 deletions bi_sql_editor/demo/bi_sql_view_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2014 - Today GRAP (http://www.grap.coop)
@author Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo noupdate="1">
<record id="incorrect_sql_view" model="bi.sql.view">
<field name="name">Draft Incorrect SQL View</field>
<field name="technical_name">incorrect_view</field>
<field
name="query"
><![CDATA[
SELECT *
FROM unexisting_table
ORDER BY unexisting_field
]]>
</field>
</record>
<record id="partner_sql_view" model="bi.sql.view">
<field name="name">Partners View</field>
<field name="technical_name">partners_view</field>
<field
name="query"
><![CDATA[
SELECT
name as x_name,
street as x_street,
company_id as x_company_id
FROM res_partner
ORDER BY name
]]>
</field>
</record>
<record id="module_sql_view" model="bi.sql.view">
<field name="name">Modules by Authors</field>
<field name="technical_name">modules_view</field>
<field name="is_materialized" eval="0" />
<field
name="query"
><![CDATA[
SELECT
name as x_name,
case
when author ilike '%OpenERP SA%' THEN 'Odoo SA'
when author ilike '%Odoo Community Association (OCA)%' THEN 'OCA'
else 'Undefined Author' END as x_author_type
FROM ir_module_module
]]>
</field>
</record>
<function
model="bi.sql.view"
name="button_validate_sql_expression"
eval="([ref('module_sql_view')])"
/>
<function
model="bi.sql.view"
name="button_create_sql_view_and_model"
eval="([ref('module_sql_view')])"
/>
<function
model="bi.sql.view"
name="button_create_ui"
eval="([ref('module_sql_view')])"
/>
</odoo>
14 changes: 14 additions & 0 deletions bi_sql_editor/demo/res_groups_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2014 - Today GRAP (http://www.grap.coop)
@author Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="base.group_no_one" model="res.groups">
<field name="users" eval="[(4, ref('base.user_admin'))]" />
</record>
<record id="sql_request_abstract.group_sql_request_user" model="res.groups">
<field name="users" eval="[(4, ref('base.user_demo'))]" />
</record>
</odoo>
11 changes: 11 additions & 0 deletions bi_sql_editor/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright 2015-2017 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import SUPERUSER_ID
from odoo.api import Environment


def uninstall_hook(cr, registry):
env = Environment(cr, SUPERUSER_ID, {})
recs = env["bi.sql.view"].search([])
for rec in recs:
rec.button_set_draft()
Loading