|
@ -39,7 +39,7 @@ class BveView(models.Model): |
|
|
('created', 'Created')], |
|
|
('created', 'Created')], |
|
|
default='draft', |
|
|
default='draft', |
|
|
copy=False) |
|
|
copy=False) |
|
|
data = fields.Text( |
|
|
|
|
|
|
|
|
data = fields.Serialized( |
|
|
help="Use the special query builder to define the query " |
|
|
help="Use the special query builder to define the query " |
|
|
"to generate your report dataset. " |
|
|
"to generate your report dataset. " |
|
|
"NOTE: To be edited, the query should be in 'Draft' status.") |
|
|
"NOTE: To be edited, the query should be in 'Draft' status.") |
|
@ -63,12 +63,6 @@ class BveView(models.Model): |
|
|
_('Custom BI View names must be unique!')), |
|
|
_('Custom BI View names must be unique!')), |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
|
def _get_format_data(cls, data): |
|
|
|
|
|
data = data.replace('\'', '"') |
|
|
|
|
|
data = data.replace(': u"', ':"') |
|
|
|
|
|
return data |
|
|
|
|
|
|
|
|
|
|
|
@api.multi |
|
|
@api.multi |
|
|
def _create_view_arch(self): |
|
|
def _create_view_arch(self): |
|
|
self.ensure_one() |
|
|
self.ensure_one() |
|
@ -96,7 +90,7 @@ class BveView(models.Model): |
|
|
view_fields.append(field_def) |
|
|
view_fields.append(field_def) |
|
|
return view_fields |
|
|
return view_fields |
|
|
|
|
|
|
|
|
fields_info = json.loads(self._get_format_data(self.data)) |
|
|
|
|
|
|
|
|
fields_info = json.loads(self.data) |
|
|
view_fields = _get_field_list(fields_info) |
|
|
view_fields = _get_field_list(fields_info) |
|
|
return view_fields |
|
|
return view_fields |
|
|
|
|
|
|
|
@ -118,7 +112,7 @@ class BveView(models.Model): |
|
|
view_fields.append(field_def) |
|
|
view_fields.append(field_def) |
|
|
return view_fields |
|
|
return view_fields |
|
|
|
|
|
|
|
|
fields_info = json.loads(self._get_format_data(self.data)) |
|
|
|
|
|
|
|
|
fields_info = json.loads(self.data) |
|
|
|
|
|
|
|
|
view_fields = _get_field_list(fields_info) |
|
|
view_fields = _get_field_list(fields_info) |
|
|
return view_fields |
|
|
return view_fields |
|
@ -218,7 +212,7 @@ class BveView(models.Model): |
|
|
a.perm_''' + access_mode, (model_name,)) |
|
|
a.perm_''' + access_mode, (model_name,)) |
|
|
return [x[0] for x in self.env.cr.fetchall()] |
|
|
return [x[0] for x in self.env.cr.fetchall()] |
|
|
|
|
|
|
|
|
info = json.loads(self._get_format_data(self.data)) |
|
|
|
|
|
|
|
|
info = json.loads(self.data) |
|
|
model_names = list(set([f['model'] for f in info])) |
|
|
model_names = list(set([f['model'] for f in info])) |
|
|
read_groups = set.intersection(*[set( |
|
|
read_groups = set.intersection(*[set( |
|
|
group_ids_with_access(model_name, 'read') |
|
|
group_ids_with_access(model_name, 'read') |
|
@ -285,7 +279,7 @@ class BveView(models.Model): |
|
|
|
|
|
|
|
|
check_empty_data(self.data) |
|
|
check_empty_data(self.data) |
|
|
|
|
|
|
|
|
formatted_data = json.loads(self._get_format_data(self.data)) |
|
|
|
|
|
|
|
|
formatted_data = json.loads(self.data) |
|
|
info = get_fields_info(formatted_data) |
|
|
info = get_fields_info(formatted_data) |
|
|
select_fields = get_fields(info) |
|
|
select_fields = get_fields(info) |
|
|
tables = get_tables(info) |
|
|
tables = get_tables(info) |
|
@ -352,7 +346,7 @@ class BveView(models.Model): |
|
|
self._create_sql_view() |
|
|
self._create_sql_view() |
|
|
|
|
|
|
|
|
# create model and fields |
|
|
# create model and fields |
|
|
data = json.loads(self._get_format_data(self.data)) |
|
|
|
|
|
|
|
|
data = json.loads(self.data) |
|
|
model_vals = { |
|
|
model_vals = { |
|
|
'name': self.name, |
|
|
'name': self.name, |
|
|
'model': self.model_name, |
|
|
'model': self.model_name, |
|
|