[MERGE] forward port of branch saas-6 up to b54fdaa

This commit is contained in:
Christophe Simonis
2016-05-17 14:00:49 +02:00
7 changed files with 19 additions and 9 deletions
+2 -1
View File
@@ -443,10 +443,11 @@ class ir_actions_act_window_view(osv.osv):
'multi': False,
}
def _auto_init(self, cr, context=None):
super(ir_actions_act_window_view, self)._auto_init(cr, context)
res = super(ir_actions_act_window_view, self)._auto_init(cr, context)
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'act_window_view_unique_mode_per_action\'')
if not cr.fetchone():
cr.execute('CREATE UNIQUE INDEX act_window_view_unique_mode_per_action ON ir_act_window_view (act_window_id, view_mode)')
return res
class ir_actions_act_window_close(osv.osv):
+2 -1
View File
@@ -270,11 +270,12 @@ class ir_attachment(osv.osv):
}
def _auto_init(self, cr, context=None):
super(ir_attachment, self)._auto_init(cr, context)
res = super(ir_attachment, self)._auto_init(cr, context)
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = %s', ('ir_attachment_res_idx',))
if not cr.fetchone():
cr.execute('CREATE INDEX ir_attachment_res_idx ON ir_attachment (res_model, res_id)')
cr.commit()
return res
def check(self, cr, uid, ids, mode, context=None, values=None):
"""Restricts the access to an ir.attachment, according to referred model
+2 -1
View File
@@ -952,13 +952,14 @@ class ir_model_data(osv.osv):
type(self).loads = self.pool.model_data_reference_ids
def _auto_init(self, cr, context=None):
super(ir_model_data, self)._auto_init(cr, context)
res = super(ir_model_data, self)._auto_init(cr, context)
cr.execute("SELECT indexname FROM pg_indexes WHERE indexname = 'ir_model_data_module_name_uniq_index'")
if not cr.fetchone():
cr.execute('CREATE UNIQUE INDEX ir_model_data_module_name_uniq_index ON ir_model_data (module, name)')
cr.execute("SELECT indexname FROM pg_indexes WHERE indexname = 'ir_model_data_model_res_id_index'")
if not cr.fetchone():
cr.execute('CREATE INDEX ir_model_data_model_res_id_index ON ir_model_data (model, res_id)')
return res
# NEW V8 API
@tools.ormcache('xmlid')
+3 -1
View File
@@ -261,7 +261,7 @@ class ir_translation(osv.osv):
'Language code of translation item must be among known languages' ), ]
def _auto_init(self, cr, context=None):
super(ir_translation, self)._auto_init(cr, context)
res = super(ir_translation, self)._auto_init(cr, context)
cr.execute("SELECT indexname FROM pg_indexes WHERE indexname LIKE 'ir_translation_%'")
indexes = [row[0] for row in cr.fetchall()]
@@ -285,6 +285,8 @@ class ir_translation(osv.osv):
cr.execute('CREATE INDEX ir_translation_ltn ON ir_translation (name, lang, type)')
cr.commit()
return res
def _check_selection_field_value(self, cr, uid, field, value, context=None):
if field == 'lang':
return
+4 -2
View File
@@ -78,10 +78,11 @@ class view_custom(osv.osv):
def _auto_init(self, cr, context=None):
super(view_custom, self)._auto_init(cr, context)
res = super(view_custom, self)._auto_init(cr, context)
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'ir_ui_view_custom_user_id_ref_id\'')
if not cr.fetchone():
cr.execute('CREATE INDEX ir_ui_view_custom_user_id_ref_id ON ir_ui_view_custom (user_id, ref_id)')
return res
def _hasclass(context, *cls):
""" Checks if the context node has all the classes passed as arguments
@@ -323,10 +324,11 @@ class view(osv.osv):
]
def _auto_init(self, cr, context=None):
super(view, self)._auto_init(cr, context)
res = super(view, self)._auto_init(cr, context)
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'ir_ui_view_model_type_inherit_id\'')
if not cr.fetchone():
cr.execute('CREATE INDEX ir_ui_view_model_type_inherit_id ON ir_ui_view (model, inherit_id)')
return res
def _compute_defaults(self, cr, uid, values, context=None):
if 'inherit_id' in values:
+2 -1
View File
@@ -167,10 +167,11 @@ class ir_values(osv.osv):
}
def _auto_init(self, cr, context=None):
super(ir_values, self)._auto_init(cr, context)
res = super(ir_values, self)._auto_init(cr, context)
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'ir_values_key_model_key2_res_id_user_id_idx\'')
if not cr.fetchone():
cr.execute('CREATE INDEX ir_values_key_model_key2_res_id_user_id_idx ON ir_values (key, model, key2, res_id, user_id)')
return res
def create(self, cr, uid, vals, context=None):
res = super(ir_values, self).create(cr, uid, vals, context=context)
+4 -2
View File
@@ -141,13 +141,14 @@ class wkf_instance(osv.osv):
'transition_ids': fields.many2many('workflow.transition', 'wkf_witm_trans', 'inst_id', 'trans_id'),
}
def _auto_init(self, cr, context=None):
super(wkf_instance, self)._auto_init(cr, context)
res = super(wkf_instance, self)._auto_init(cr, context)
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'wkf_instance_res_type_res_id_state_index\'')
if not cr.fetchone():
cr.execute('CREATE INDEX wkf_instance_res_type_res_id_state_index ON wkf_instance (res_type, res_id, state)')
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'wkf_instance_res_id_wkf_id_index\'')
if not cr.fetchone():
cr.execute('CREATE INDEX wkf_instance_res_id_wkf_id_index ON wkf_instance (res_id, wkf_id)')
return res
wkf_instance()
@@ -176,8 +177,9 @@ class wkf_triggers(osv.osv):
'workitem_id': fields.many2one('workflow.workitem', 'Workitem', required=True, ondelete="cascade"),
}
def _auto_init(self, cr, context=None):
super(wkf_triggers, self)._auto_init(cr, context)
res = super(wkf_triggers, self)._auto_init(cr, context)
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'wkf_triggers_res_id_model_index\'')
if not cr.fetchone():
cr.execute('CREATE INDEX wkf_triggers_res_id_model_index ON wkf_triggers (res_id, model)')
return res
wkf_triggers()