Browse Source

[IMP] preview button

14.0-report-py3o-pr-506
Darshan Patel 7 years ago
committed by David James
parent
commit
1ff35f17f7
  1. 6
      bi_sql_editor/models/bi_sql_view.py
  2. 1
      bi_sql_editor/views/view_bi_sql_view.xml

6
bi_sql_editor/models/bi_sql_view.py

@ -570,3 +570,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