mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[MIG] bi_sql_editor : from 15.0 to 16.0
- move menu and action in according view file - use new sql_request_abstract menu entry for SQL views configuration - Use sql_request_abstract primary tree view - Use sql_request_abstract primary form view - move has_grouped_changed in sql_request_abstract module - improve demo data - add default count value to display in pivot, if no pivot_measures are defined ; - set widget handle to sequence field - reorder fields in tree view and add optional hide for some fields - simplify : make field_description field required - improve : add optional='hide' and 'show' on tree visibility - replace obsolete base.menu_board_root by spreadsheet_dashboard entries - update translation
This commit is contained in:
committed by
OCA-git-bot
parent
d62f47fd19
commit
6be6f7d02f
@@ -117,8 +117,6 @@ class BiSQLView(models.Model):
|
||||
},
|
||||
)
|
||||
|
||||
has_group_changed = fields.Boolean(copy=False)
|
||||
|
||||
bi_sql_view_field_ids = fields.One2many(
|
||||
string="SQL Fields",
|
||||
comodel_name="bi.sql.view.field",
|
||||
@@ -203,6 +201,11 @@ class BiSQLView(models.Model):
|
||||
):
|
||||
action["pivot_measures"].append(field.name)
|
||||
|
||||
# If no measure are defined, we display by default the count
|
||||
# of the element, to avoid an empty view
|
||||
if not action["pivot_measures"]:
|
||||
action["pivot_measures"] = ["__count__"]
|
||||
|
||||
for field in rec.bi_sql_view_field_ids.filtered(
|
||||
lambda x: x.graph_type == "row"
|
||||
):
|
||||
@@ -238,14 +241,9 @@ class BiSQLView(models.Model):
|
||||
sql_view.technical_name,
|
||||
)
|
||||
|
||||
@api.onchange("group_ids")
|
||||
def onchange_group_ids(self):
|
||||
if self.state not in ("draft", "sql_valid"):
|
||||
self.has_group_changed = True
|
||||
|
||||
# Overload Section
|
||||
def write(self, vals):
|
||||
res = super(BiSQLView, self).write(vals)
|
||||
res = super().write(vals)
|
||||
if vals.get("sequence", False):
|
||||
for rec in self.filtered(lambda x: x.menu_id):
|
||||
rec.menu_id.sequence = rec.sequence
|
||||
@@ -260,7 +258,7 @@ class BiSQLView(models.Model):
|
||||
)
|
||||
)
|
||||
self.cron_id.unlink()
|
||||
return super(BiSQLView, self).unlink()
|
||||
return super().unlink()
|
||||
|
||||
def copy(self, default=None):
|
||||
self.ensure_one()
|
||||
@@ -271,7 +269,7 @@ class BiSQLView(models.Model):
|
||||
"technical_name": "%s_copy" % self.technical_name,
|
||||
}
|
||||
)
|
||||
return super(BiSQLView, self).copy(default=default)
|
||||
return super().copy(default=default)
|
||||
|
||||
# Action Section
|
||||
def button_create_sql_view_and_model(self):
|
||||
@@ -313,7 +311,6 @@ class BiSQLView(models.Model):
|
||||
# Drop ORM
|
||||
sql_view._drop_model_and_fields()
|
||||
|
||||
sql_view.has_group_changed = False
|
||||
super(BiSQLView, sql_view).button_set_draft()
|
||||
return True
|
||||
|
||||
@@ -636,7 +633,7 @@ class BiSQLView(models.Model):
|
||||
the database structure is done, to know fields type."""
|
||||
self.ensure_one()
|
||||
sql_view_field_obj = self.env["bi.sql.view.field"]
|
||||
columns = super(BiSQLView, self)._check_execution()
|
||||
columns = super()._check_execution()
|
||||
field_ids = []
|
||||
for column in columns:
|
||||
existing_field = self.bi_sql_view_field_ids.filtered(
|
||||
|
||||
Reference in New Issue
Block a user