diff --git a/bi_sql_editor/README.rst b/bi_sql_editor/README.rst
index a08f05b2..c483d14d 100644
--- a/bi_sql_editor/README.rst
+++ b/bi_sql_editor/README.rst
@@ -152,7 +152,7 @@ Contributors
* 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/8.0/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
diff --git a/bi_sql_editor/__openerp__.py b/bi_sql_editor/__openerp__.py
index 0a131a26..a69a1cad 100644
--- a/bi_sql_editor/__openerp__.py
+++ b/bi_sql_editor/__openerp__.py
@@ -6,7 +6,7 @@
{
'name': 'BI SQL Editor',
'summary': "BI Views builder, based on Materialized or Normal SQL Views",
- 'version': '8.0.1.0.0',
+ 'version': '9.0.1.0.0',
'license': 'AGPL-3',
'category': 'Reporting',
'author': 'GRAP,Odoo Community Association (OCA)',
diff --git a/bi_sql_editor/models/bi_sql_view.py b/bi_sql_editor/models/bi_sql_view.py
index 4c282102..e29133d2 100644
--- a/bi_sql_editor/models/bi_sql_view.py
+++ b/bi_sql_editor/models/bi_sql_view.py
@@ -89,6 +89,9 @@ class BiSQLView(models.Model):
graph_view_id = fields.Many2one(
string='Odoo Graph View', comodel_name='ir.ui.view', readonly=True)
+ pivot_view_id = fields.Many2one(
+ string='Odoo Pivot View', comodel_name='ir.ui.view', readonly=True)
+
search_view_id = fields.Many2one(
string='Odoo Search View', comodel_name='ir.ui.view', readonly=True)
@@ -184,6 +187,7 @@ class BiSQLView(models.Model):
sql_view._drop_model_and_fields()
sql_view.graph_view_id.unlink()
+ sql_view.pivot_view_id.unlink()
sql_view.action_id.unlink()
sql_view.menu_id.unlink()
sql_view.rule_id.unlink()
@@ -195,6 +199,8 @@ class BiSQLView(models.Model):
def button_create_ui(self):
self.graph_view_id = self.env['ir.ui.view'].create(
self._prepare_graph_view()).id
+ self.pivot_view_id = self.env['ir.ui.view'].create(
+ self._prepare_pivot_view()).id
self.search_view_id = self.env['ir.ui.view'].create(
self._prepare_search_view()).id
self.action_id = self.env['ir.actions.act_window'].create(
@@ -218,10 +224,9 @@ class BiSQLView(models.Model):
return {
'type': 'ir.actions.act_window',
'res_model': self.model_id.model,
- 'view_id': self.graph_view_id.id,
'search_view_id': self.search_view_id.id,
- 'view_type': 'graph',
- 'view_mode': 'graph',
+ 'view_type': 'form',
+ 'view_mode': 'graph,pivot',
}
# Prepare Function
@@ -292,6 +297,21 @@ class BiSQLView(models.Model):
for x in self.bi_sql_view_field_ids]))
}
+ @api.multi
+ def _prepare_pivot_view(self):
+ self.ensure_one()
+ return {
+ 'name': self.name,
+ 'type': 'pivot',
+ 'model': self.model_id.model,
+ 'arch':
+ """"""
+ """{}"""
+ """""".format("".join(
+ [x._prepare_pivot_field()
+ for x in self.bi_sql_view_field_ids]))
+ }
+
@api.multi
def _prepare_search_view(self):
self.ensure_one()
@@ -320,8 +340,7 @@ class BiSQLView(models.Model):
'res_model': self.model_id.model,
'type': 'ir.actions.act_window',
'view_type': 'form',
- 'view_mode': 'graph',
- 'view_id': self.graph_view_id.id,
+ 'view_mode': 'graph,pivot',
'search_view_id': self.search_view_id.id,
}
diff --git a/bi_sql_editor/models/bi_sql_view_field.py b/bi_sql_editor/models/bi_sql_view_field.py
index 76f20657..533674b7 100644
--- a/bi_sql_editor/models/bi_sql_view_field.py
+++ b/bi_sql_editor/models/bi_sql_view_field.py
@@ -175,6 +175,15 @@ class BiSQLViewField(models.Model):
self.name, self.graph_type)
return res
+ @api.multi
+ def _prepare_pivot_field(self):
+ self.ensure_one()
+ res = ''
+ if self.graph_type and self.field_description:
+ res = """""".format(
+ self.name, self.graph_type)
+ return res
+
@api.multi
def _prepare_search_field(self):
self.ensure_one()
diff --git a/bi_sql_editor/views/menu.xml b/bi_sql_editor/views/menu.xml
index 5fe24bab..061f0d75 100644
--- a/bi_sql_editor/views/menu.xml
+++ b/bi_sql_editor/views/menu.xml
@@ -10,7 +10,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).