Browse Source

[FIX] ir.cron relation

pull/264/head
mreficent 6 years ago
committed by Adrià Gil Sorribes
parent
commit
44d8e1433a
  1. 12
      bi_sql_editor/models/bi_sql_view.py
  2. 2
      bi_sql_editor/views/view_bi_sql_view.xml

12
bi_sql_editor/models/bi_sql_view.py

@ -232,7 +232,7 @@ class BiSQLView(models.Model):
if sql_view.state != 'sql_valid': if sql_view.state != 'sql_valid':
raise UserError(_( raise UserError(_(
"You can only process this action on SQL Valid items")) "You can only process this action on SQL Valid items"))
# Create ORM and acess
# Create ORM and access
sql_view._create_model_and_fields() sql_view._create_model_and_fields()
sql_view._create_model_access() sql_view._create_model_access()
@ -342,9 +342,9 @@ class BiSQLView(models.Model):
'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,
'function': '_refresh_materialized_view_cron',
'state': 'code',
'code': 'model._refresh_materialized_view_cron(%s)' % self.ids,
'numbercall': -1, 'numbercall': -1,
'args': repr(([self.id],))
} }
@api.multi @api.multi
@ -610,7 +610,11 @@ class BiSQLView(models.Model):
@api.model @api.model
def _refresh_materialized_view_cron(self, view_ids): def _refresh_materialized_view_cron(self, view_ids):
sql_views = self.browse(view_ids)
sql_views = self.search([
('is_materialized', '=', True),
('state', 'in', ['model_valid', 'ui_valid']),
('id', 'in', view_ids),
])
return sql_views._refresh_materialized_view() return sql_views._refresh_materialized_view()
@api.multi @api.multi

2
bi_sql_editor/views/view_bi_sql_view.xml

@ -38,7 +38,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
help="This will try to create an SQL View, based on the SQL request and the according Transient Model and fields, based on settings"/> help="This will try to create an SQL View, based on the SQL request and the according Transient Model and fields, based on settings"/>
<button name="button_update_model_access" type="object" <button name="button_update_model_access" type="object"
attrs="{'invisible': ['|', ('state', 'in', ('draft', 'sql_valid')), ('has_group_changed', '=', False)]}" attrs="{'invisible': ['|', ('state', 'in', ('draft', 'sql_valid')), ('has_group_changed', '=', False)]}"
string="Update Model Acess" class="oe_highlight"
string="Update Model Access" class="oe_highlight"
help="Update Model Access. Required if you changed groups list after having created the model"/> help="Update Model Access. Required if you changed groups list after having created the model"/>
<button name="button_create_ui" type="object" states="model_valid" string="Create UI" <button name="button_create_ui" type="object" states="model_valid" string="Create UI"
class="oe_highlight" help="This will create Odoo View, Action and Menu"/> class="oe_highlight" help="This will create Odoo View, Action and Menu"/>

Loading…
Cancel
Save