diff --git a/bi_sql_editor/README.rst b/bi_sql_editor/README.rst index dd206a4e..1bfc8a3a 100644 --- a/bi_sql_editor/README.rst +++ b/bi_sql_editor/README.rst @@ -1,10 +1,29 @@ -.. 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 +============= +BI SQL Editor +============= -=========================================================== -BI Views builder, based on Materialized or Normal SQL Views -=========================================================== +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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/12.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-12-0/reporting-engine-12-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/12.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. @@ -47,6 +66,11 @@ this module is interesting for the following use cases * 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: + Configuration ============= @@ -106,15 +130,15 @@ To use this module, you need to: .. figure:: /bi_sql_editor/static/description/05_reporting_pie.png :width: 800 px -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/143/10.0 +Bug Tracker +=========== -Known issues / Roadmap -====================== +Bugs are tracked on `GitHub 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 `_. -* Add 'interval', after type (row/col/measure) field for date(time) fields. -* Possibly avoid the monkey patches +Do not contact contributors directly about support or help with technical issues. Note ==== @@ -135,19 +159,16 @@ Sample: SELECT name as x_name FROM res_partner -Bug Tracker -=========== - -Bugs are tracked on `GitHub Issues -`_. In case of trouble, please -check there if your issue has already been reported. If you spotted it first, -help us smash it by providing detailed and welcomed feedback. - Credits ======= +Authors +~~~~~~~ + +* GRAP + Contributors ------------- +~~~~~~~~~~~~ * Sylvain LE GAL (https://twitter.com/legalsylvain) @@ -162,25 +183,26 @@ Contributors Module: grap/odoo-addons-misc/pos_sale_reporting link: https://github.com/grap/odoo-addons-misc/tree/7.0/pos_sale_reporting - Funders -------- +~~~~~~~ The development of this module has been financially supported by: * GRAP, Groupement Régional Alimentaire de Proximité (http://www.grap.coop) -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - 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. -To contribute to this module, please visit https://odoo-community.org. +This module is part of the `OCA/reporting-engine `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/bi_sql_editor/__manifest__.py b/bi_sql_editor/__manifest__.py index 15795496..edc7fbd2 100644 --- a/bi_sql_editor/__manifest__.py +++ b/bi_sql_editor/__manifest__.py @@ -5,7 +5,7 @@ { 'name': 'BI SQL Editor', 'summary': 'BI Views builder, based on Materialized or Normal SQL Views', - 'version': '11.0.1.0.0', + 'version': '12.0.1.0.0', 'license': 'AGPL-3', 'category': 'Reporting', 'author': 'GRAP,Odoo Community Association (OCA)', diff --git a/bi_sql_editor/demo/res_groups_demo.xml b/bi_sql_editor/demo/res_groups_demo.xml index 7771a95a..f9377b73 100644 --- a/bi_sql_editor/demo/res_groups_demo.xml +++ b/bi_sql_editor/demo/res_groups_demo.xml @@ -7,7 +7,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - + diff --git a/bi_sql_editor/models/bi_sql_view.py b/bi_sql_editor/models/bi_sql_view.py index cda6a469..20c5e835 100644 --- a/bi_sql_editor/models/bi_sql_view.py +++ b/bi_sql_editor/models/bi_sql_view.py @@ -9,7 +9,7 @@ from psycopg2 import ProgrammingError from odoo import _, api, fields, models, SUPERUSER_ID from odoo.exceptions import UserError from odoo.tools import pycompat, sql -from odoo.addons.base.ir.ir_model import IrModel +from odoo.addons.base.models.ir_model import IrModel _logger = logging.getLogger(__name__) diff --git a/bi_sql_editor/models/bi_sql_view_field.py b/bi_sql_editor/models/bi_sql_view_field.py index 14ea659d..291c1e11 100644 --- a/bi_sql_editor/models/bi_sql_view_field.py +++ b/bi_sql_editor/models/bi_sql_view_field.py @@ -10,6 +10,7 @@ from odoo.exceptions import UserError class BiSQLViewField(models.Model): _name = 'bi.sql.view.field' + _description = 'Bi SQL View Field' _order = 'sequence' _TTYPE_SELECTION = [ diff --git a/bi_sql_editor/readme/CONFIGURE.rst b/bi_sql_editor/readme/CONFIGURE.rst new file mode 100644 index 00000000..20f7b6ae --- /dev/null +++ b/bi_sql_editor/readme/CONFIGURE.rst @@ -0,0 +1,38 @@ +To configure this module, you need to: + +* Go to Settings / Technical / Database Structure / SQL Views + +* tip your SQL request + + .. figure:: /bi_sql_editor/static/description/01_sql_request.png + :width: 800 px + +* Select the group(s) that could have access to the view + + .. figure:: /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:: /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:: /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. diff --git a/bi_sql_editor/readme/CONTRIBUTORS.rst b/bi_sql_editor/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..6837a2b2 --- /dev/null +++ b/bi_sql_editor/readme/CONTRIBUTORS.rst @@ -0,0 +1,12 @@ +* Sylvain LE GAL (https://twitter.com/legalsylvain) + +* 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 diff --git a/bi_sql_editor/readme/DESCRIPTION.rst b/bi_sql_editor/readme/DESCRIPTION.rst new file mode 100644 index 00000000..33d6b20e --- /dev/null +++ b/bi_sql_editor/readme/DESCRIPTION.rst @@ -0,0 +1,40 @@ +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 diff --git a/bi_sql_editor/readme/USAGE.rst b/bi_sql_editor/readme/USAGE.rst new file mode 100644 index 00000000..bb887e7e --- /dev/null +++ b/bi_sql_editor/readme/USAGE.rst @@ -0,0 +1,13 @@ +To use this module, you need to: + +#. Go to 'Reporting' / 'Custom Reports' + +#. Select the desired report + + .. figure:: /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:: /bi_sql_editor/static/description/05_reporting_pie.png + :width: 800 px diff --git a/bi_sql_editor/static/description/index.html b/bi_sql_editor/static/description/index.html new file mode 100644 index 00000000..8bf7238b --- /dev/null +++ b/bi_sql_editor/static/description/index.html @@ -0,0 +1,514 @@ + + + + + + +BI SQL Editor + + + +
+

BI SQL Editor

+ + +

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runbot

+

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

+ +
+

Configuration

+

To configure this module, you need to:

+
    +
  • Go to Settings / Technical / Database Structure / SQL Views

    +
  • +
  • tip your SQL request

    +
    +/bi_sql_editor/static/description/01_sql_request.png +
    +
  • +
  • Select the group(s) that could have access to the view

    +
    +/bi_sql_editor/static/description/02_security_access.png +
    +
  • +
  • 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.

    +
    +/bi_sql_editor/static/description/03_field_mapping.png +
    +
  • +
  • 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)
    • +
    +
    +
    +/bi_sql_editor/static/description/04_materialized_view_setting.png +
    +
  • +
  • Finally, click on ‘Create UI’, to create new menu, action, graph view and +search view.

    +
  • +
+
+
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to ‘Reporting’ / ‘Custom Reports’
  2. +
  3. Select the desired report
  4. +
+
+
+/bi_sql_editor/static/description/05_reporting_pivot.png +
+
+
    +
  • You can switch to ‘Pie’ chart or ‘Line Chart’ as any report,

    +
    +/bi_sql_editor/static/description/05_reporting_pie.png +
    +
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • GRAP
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/reporting-engine project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+
+ + diff --git a/bi_sql_editor/views/menu.xml b/bi_sql_editor/views/menu.xml index 7a9bebe5..46087d5c 100644 --- a/bi_sql_editor/views/menu.xml +++ b/bi_sql_editor/views/menu.xml @@ -9,12 +9,14 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + name="SQL Reports" + parent="base.menu_board_root" + groups="sql_request_abstract.group_sql_request_user" + sequence="0"/> + parent="base.next_id_9" + groups="sql_request_abstract.group_sql_request_manager" + action="action_bi_sql_view"/>
diff --git a/oca_dependencies.txt b/oca_dependencies.txt new file mode 100644 index 00000000..add759da --- /dev/null +++ b/oca_dependencies.txt @@ -0,0 +1,3 @@ +server-tools +# Until merged +server-tools-eficent https://github.com/Eficent/server-tools 12.0-mig-sql_request_abstract \ No newline at end of file