Browse Source

[IMP] remove unneeded parenthesis

pull/264/head
mreficent 6 years ago
committed by Adrià Gil Sorribes
parent
commit
5ca13e5604
  1. 18
      bi_sql_editor/models/bi_sql_view.py

18
bi_sql_editor/models/bi_sql_view.py

@ -220,8 +220,8 @@ class BiSQLView(models.Model):
self.ensure_one() self.ensure_one()
default = dict(default or {}) default = dict(default or {})
default.update({ default.update({
'name': _('%s (Copy)') % (self.name),
'technical_name': '%s_copy' % (self.technical_name),
'name': _('%s (Copy)') % self.name,
'technical_name': '%s_copy' % self.technical_name,
}) })
return super(BiSQLView, self).copy(default=default) return super(BiSQLView, self).copy(default=default)
@ -338,7 +338,7 @@ class BiSQLView(models.Model):
def _prepare_cron(self): def _prepare_cron(self):
self.ensure_one() self.ensure_one()
return { return {
'name': _('Refresh Materialized View %s') % (self.view_name),
'name': _('Refresh Materialized View %s') % self.view_name,
'user_id': SUPERUSER_ID, 'user_id': SUPERUSER_ID,
'model_id': self.env['ir.model'].search([ 'model_id': self.env['ir.model'].search([
('model', '=', self._name)], limit=1).id, ('model', '=', self._name)], limit=1).id,
@ -351,7 +351,7 @@ class BiSQLView(models.Model):
def _prepare_rule(self): def _prepare_rule(self):
self.ensure_one() self.ensure_one()
return { return {
'name': _('Access %s') % (self.name),
'name': _('Access %s') % self.name,
'model_id': self.model_id.id, 'model_id': self.model_id.id,
'domain_force': self.domain_force, 'domain_force': self.domain_force,
'global': True, 'global': True,
@ -457,13 +457,13 @@ class BiSQLView(models.Model):
return { return {
'name': self.name, 'name': self.name,
'parent_id': self.env.ref('bi_sql_editor.menu_bi_sql_editor').id, 'parent_id': self.env.ref('bi_sql_editor.menu_bi_sql_editor').id,
'action': 'ir.actions.act_window,%s' % (self.action_id.id),
'action': 'ir.actions.act_window,%s' % self.action_id.id,
'sequence': self.sequence, 'sequence': self.sequence,
} }
# Custom Section # Custom Section
def _log_execute(self, req): def _log_execute(self, req):
_logger.info("Executing SQL Request %s ..." % (req))
_logger.info("Executing SQL Request %s ..." % req)
self.env.cr.execute(req) self.env.cr.execute(req)
@api.multi @api.multi
@ -506,7 +506,7 @@ class BiSQLView(models.Model):
sql_view.rule_id = self.env['ir.rule'].create( sql_view.rule_id = self.env['ir.rule'].create(
self._prepare_rule()).id self._prepare_rule()).id
# Drop table, created by the ORM # Drop table, created by the ORM
req = "DROP TABLE %s" % (sql_view.view_name)
req = "DROP TABLE %s" % sql_view.view_name
self._log_execute(req) self._log_execute(req)
@api.multi @api.multi
@ -540,7 +540,7 @@ class BiSQLView(models.Model):
WHERE attrelid = '%s'::regclass WHERE attrelid = '%s'::regclass
AND NOT attisdropped AND NOT attisdropped
AND attnum > 0 AND attnum > 0
ORDER BY attnum;""" % (self.view_name)
ORDER BY attnum;""" % self.view_name
self._log_execute(req) self._log_execute(req)
return self.env.cr.fetchall() return self.env.cr.fetchall()
@ -562,7 +562,7 @@ class BiSQLView(models.Model):
my_query.* my_query.*
FROM FROM
(%s) as my_query (%s) as my_query
""" % (self.query)
""" % self.query
return "CREATE %s VIEW %s AS (%s);" % ( return "CREATE %s VIEW %s AS (%s);" % (
self.materialized_text, self.view_name, query) self.materialized_text, self.view_name, query)

Loading…
Cancel
Save