mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[MIG] sql_request_abstract from 15.0 to 16.0
- Add new main entry menu for SQL configuration - Add abstract tree view - Add abstract form view - ADD ace/mode-pgsql.js file to have syntaxic coloration in sql field - move has_grouped_changed from bi_sql_editor to sql_request_abstract - remove main menu entries, replaced by new spreadsheet menu entries in V16 - update translation - IMP : inherit from mail.thread to use chatter - ADD : new note fields - REF : add comment on has_grouped_changed field
This commit is contained in:
@@ -20,6 +20,8 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class SQLRequestMixin(models.AbstractModel):
|
||||
_name = "sql.request.mixin"
|
||||
_inherit = ["mail.thread"]
|
||||
|
||||
_description = "SQL Request Mixin"
|
||||
|
||||
_clean_query_enabled = True
|
||||
@@ -61,6 +63,8 @@ class SQLRequestMixin(models.AbstractModel):
|
||||
# Columns Section
|
||||
name = fields.Char(required=True)
|
||||
|
||||
note = fields.Html()
|
||||
|
||||
query = fields.Text(
|
||||
required=True,
|
||||
help="You can't use the following words"
|
||||
@@ -93,6 +97,19 @@ class SQLRequestMixin(models.AbstractModel):
|
||||
default=_default_user_ids,
|
||||
)
|
||||
|
||||
has_group_changed = fields.Boolean(
|
||||
copy=False,
|
||||
help="Technical fields, used in modules"
|
||||
" that depends on this one to know"
|
||||
" if groups has changed, and that according"
|
||||
" access should be updated.",
|
||||
)
|
||||
|
||||
@api.onchange("group_ids")
|
||||
def onchange_group_ids(self):
|
||||
if self.state not in ("draft", "sql_valid"):
|
||||
self.has_group_changed = True
|
||||
|
||||
# Action Section
|
||||
def button_validate_sql_expression(self):
|
||||
for item in self:
|
||||
@@ -105,7 +122,12 @@ class SQLRequestMixin(models.AbstractModel):
|
||||
item.state = "sql_valid"
|
||||
|
||||
def button_set_draft(self):
|
||||
self.write({"state": "draft"})
|
||||
self.write(
|
||||
{
|
||||
"has_group_changed": False,
|
||||
"state": "draft",
|
||||
}
|
||||
)
|
||||
|
||||
# API Section
|
||||
def _execute_sql_request(
|
||||
|
||||
Reference in New Issue
Block a user