-
-
Notifications
You must be signed in to change notification settings - Fork 774
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
101 changed files
with
27,620 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
============== | ||
BI View 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/12.0/bi_view_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_view_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| | ||
|
||
BI View Editor is a tool integrated in Odoo that allows users define and | ||
execute their own reports without the need to code. | ||
|
||
Purpose: | ||
|
||
* The BI View Editor is used to create reports not already contained in the | ||
standard Odoo, combining data from existing sources. | ||
|
||
* It has been designed to be used by users with little or no knowledge of | ||
the technical architecture of Odoo. Users visually link business objects | ||
and select the fields to visualize. | ||
|
||
* The BI View Editor offers users different types of representations, | ||
including tree, graph, pivot views. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Installation | ||
============ | ||
|
||
In the Odoo configuration file add ``bi_view_editor`` in the list | ||
``server_wide_modules``: | ||
|
||
.. code-block:: ini | ||
[options] | ||
(...) | ||
server_wide_modules = web,bi_view_editor | ||
(...) | ||
Alternatively specify ``--load=bi_view_editor`` when starting Odoo by command line. | ||
|
||
Optionally it is possible to enable the view of the ER Diagram. For this you | ||
need to install `Graphviz`, an open source graph visualization software: | ||
|
||
.. code-block:: bash | ||
``sudo apt-get install graphviz`` | ||
Usage | ||
===== | ||
|
||
To graphically design your analysis data-set: | ||
|
||
- From the Dashboards menu, select "Custom BI Views" | ||
- Browse trough the business objects in the "Query Builder" tab | ||
- Pick the interesting fields (Drag & Drop) | ||
- For each selected field, right-click on the Options column and select whether | ||
it's a row, column or measure; if you want to remove the field from the list | ||
view, unflag the checkbox ´List´ in the Options column | ||
- Save and click "Generate BI View" | ||
- Click "Open BI View" to view the result | ||
|
||
To access the created BI View with a dedicated menu: | ||
|
||
- If module Dashboard (board) is installed, the standard "Add to My Dashboard" | ||
functionality would be available | ||
- Click "Create a menu" to create a new menu item directly linked to your new | ||
BI view (this feature is available in developer mode); when the BI view is | ||
reset back to draft this menu will be removed, and you will need to re-create | ||
the menu entry. | ||
|
||
A more advanced UI is also available under the "Details" tab. It provides extra | ||
possibilities for more advanced users, like to use LEFT JOIN instead of the | ||
default INNER JOIN. | ||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
* Non-stored fields and many2many fields are not supported. | ||
* Provide a tutorial (eg. a working example of usage). | ||
* Find better ways to extend the *_auto_init()* without override. | ||
* Possibly avoid the monkey patches. | ||
* Data the user has no access to (e.g. in a multi company situation) can be | ||
viewed by making a view. Would be nice if models available to select when | ||
creating a view are limited to the ones that have intersecting groups. | ||
|
||
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_view_editor%0Aversion:%2012.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 | ||
~~~~~~~ | ||
|
||
* Onestein | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Simon Janssens <s.janssens@onestein.nl> | ||
* Diego Luis Neto <diegoluis.neto@gmail.com> | ||
* Dennis Sluijk <d.sluijk@onestein.nl> | ||
* Kevin Graveman <k.graveman@onestein.nl> | ||
* Richard Dijkstra <r.dijkstra@onestein.nl> | ||
* Andrea Stirpe <a.stirpe@onestein.nl> | ||
* Antonio Esposito <a.esposito@onestein.nl> | ||
* Jordi Ballester Alomar <jordi.ballester@eficent.com> | ||
|
||
Other credits | ||
~~~~~~~~~~~~~ | ||
|
||
Funders | ||
------- | ||
|
||
The development of this module for Odoo 11.0 has been financially supported by: | ||
|
||
* IDEAL Connaissances SAS https://www.idealconnaissances.com | ||
|
||
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. | ||
|
||
This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/12.0/bi_view_editor>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import models | ||
from . import wizard | ||
from .hooks import post_load, uninstall_hook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 2015-2019 Onestein (<https://www.onestein.eu>) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
'name': 'BI View Editor', | ||
'summary': 'Graphical BI views builder for Odoo', | ||
'images': ['static/description/main_screenshot.png'], | ||
'author': 'Onestein,Odoo Community Association (OCA)', | ||
'license': 'AGPL-3', | ||
'website': 'https://github.com/OCA/reporting-engine', | ||
'category': 'Reporting', | ||
'version': '12.0.1.0.0', | ||
'development_status': 'Beta', | ||
'depends': [ | ||
'web', | ||
], | ||
'data': [ | ||
'security/ir.model.access.csv', | ||
'security/rules.xml', | ||
'templates/assets_template.xml', | ||
'views/bve_view.xml', | ||
], | ||
'qweb': [ | ||
'static/src/xml/bi_view_editor.xml' | ||
], | ||
'post_load': 'post_load', | ||
'uninstall_hook': 'uninstall_hook', | ||
'installable': True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Copyright 2015-2019 Onestein (<https://www.onestein.eu>) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
import logging | ||
|
||
from odoo import SUPERUSER_ID | ||
from odoo import api, modules | ||
|
||
from odoo.tools import existing_tables, topological_sort | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
def _bi_view(_name): | ||
return _name.startswith('x_bve.') | ||
|
||
|
||
def post_load(): | ||
|
||
def check_tables_exist(self, cr): | ||
""" | ||
Verify that all tables are present and try to initialize | ||
those that are missing. | ||
""" | ||
# This monkey patch is meant to avoid that the _logger writes | ||
# warning and error messages, while running an update all, | ||
# in case the model is a bi-view-generated model. | ||
|
||
env = api.Environment(cr, SUPERUSER_ID, {}) | ||
table2model = { | ||
model._table: name for name, model in env.items() | ||
if not model._abstract and not _bi_view(name) # here is the patch | ||
} | ||
missing_tables = set(table2model).difference( | ||
existing_tables(cr, table2model)) | ||
|
||
if missing_tables: | ||
missing = {table2model[table] for table in missing_tables} | ||
_logger.warning("Models have no table: %s.", ", ".join(missing)) | ||
# recreate missing tables following model dependencies | ||
deps = {name: model._depends for name, model in env.items()} | ||
for name in topological_sort(deps): | ||
if name in missing: | ||
_logger.info("Recreate table of model %s.", name) | ||
env[name].init() | ||
# check again, and log errors if tables are still missing | ||
missing_tables = set(table2model).difference( | ||
existing_tables(cr, table2model)) | ||
for table in missing_tables: | ||
_logger.error("Model %s has no table.", table2model[table]) | ||
|
||
modules.registry.Registry.check_tables_exist = check_tables_exist | ||
|
||
|
||
def uninstall_hook(cr, registry): | ||
# delete dirty data that could cause problems | ||
# while re-installing the module | ||
cr.execute(""" | ||
delete from ir_model where model like 'x_bve.%' | ||
""") | ||
cr.execute(""" | ||
delete from bve_view where model_name like 'x_bve.%' | ||
""") | ||
cr.execute(""" | ||
SELECT 'DROP VIEW ' || table_name | ||
FROM information_schema.views | ||
WHERE table_schema NOT IN ('pg_catalog', 'information_schema') | ||
AND table_name like 'x_bve_%' | ||
""") | ||
results = list(cr.fetchall()) | ||
for result in results: | ||
cr.execute(result[0]) |
Oops, something went wrong.