Browse Source

Merge PR #2061 into 12.0

Signed-off-by pedrobaeza
12.0-mig-module_prototyper_last
OCA-git-bot 4 years ago
parent
commit
e038f5beba
  1. 1
      sql_export/views/sql_export_view.xml
  2. 6
      sql_request_abstract/models/sql_request_mixin.py

1
sql_export/views/sql_export_view.xml

@ -8,6 +8,7 @@
<header>
<button name="button_validate_sql_expression" type="object" states="draft"
string="Validate SQL Expression" class="oe_highlight"/>
<button name="button_preview_sql_expression" type="object" states="draft" string="Preview Results" attrs="{'invisible': [('field_ids', '!=', False)]}"/>
<button name="button_set_draft" type="object" states="sql_valid"
string="Set to Draft" groups="sql_request_abstract.group_sql_request_manager"/>
<button name="export_sql_query" string="Execute Query" states="sql_valid" type="object" class="oe_highlight"

6
sql_request_abstract/models/sql_request_mixin.py

@ -270,3 +270,9 @@ class SQLRequestMixin(models.AbstractModel):
"""
self.ensure_one()
return False
@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])))
Loading…
Cancel
Save