Browse Source

[9.0] IMP bi_sql_editor (#156)

pull/283/head
Nicolas Mac Rouillon 6 years ago
committed by Sylvain LE GAL
parent
commit
7c3043b12c
  1. 2
      bi_sql_editor/__openerp__.py
  2. 6
      bi_sql_editor/models/bi_sql_view.py
  3. 1
      bi_sql_editor/views/view_bi_sql_view.xml

2
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': '9.0.1.0.0',
'version': '9.0.1.1.0',
'license': 'AGPL-3',
'category': 'Reporting',
'author': 'GRAP,Odoo Community Association (OCA)',

6
bi_sql_editor/models/bi_sql_view.py

@ -571,3 +571,9 @@ class BiSQLView(models.Model):
sql_view.view_name)
self.env.cr.execute(req)
sql_view.size = self.env.cr.fetchone()[0]
@api.multi
def button_preview_sql_expression(self):
self.button_validate_sql_expression()
res = self._execute_sql_request()
raise UserError('\n'.join(map(lambda x: str(x), res[:100])))

1
bi_sql_editor/views/view_bi_sql_view.xml

@ -29,6 +29,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<button name="button_set_draft" type="object" states="sql_valid,model_valid,ui_valid"
string="Set to Draft" groups="sql_request_abstract.group_sql_request_manager"
confirm="Are you sure you want to set to draft this SQL View. It will delete the materialized view, and all the previous mapping realized with the columns"/>
<button name="button_preview_sql_expression" type="object" states="draft" string="Preview SQL Expression" class="oe_highlight"/>
<button name="button_create_sql_view_and_model" type="object" states="sql_valid"
string="Create SQL View, Indexes and Models" class="oe_highlight"
help="This will try to create an SQL View, based on the SQL request and the according Transient Model and fields, based on settings"/>

Loading…
Cancel
Save