[FIX] base: Add missing return values
The _auto_init method was overriden without keeping the return value of the super on some models. This break the new stored computed fields computation at field creation. Closes #11985 opw-677232
This commit is contained in:
parent
a0484cbe45
commit
f4cb884cdc
|
@ -300,10 +300,11 @@ class act_window_view(osv.osv):
|
||||||
'multi': False,
|
'multi': False,
|
||||||
}
|
}
|
||||||
def _auto_init(self, cr, context=None):
|
def _auto_init(self, cr, context=None):
|
||||||
super(act_window_view, self)._auto_init(cr, context)
|
res = super(act_window_view, self)._auto_init(cr, context)
|
||||||
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'act_window_view_unique_mode_per_action\'')
|
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'act_window_view_unique_mode_per_action\'')
|
||||||
if not cr.fetchone():
|
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)')
|
cr.execute('CREATE UNIQUE INDEX act_window_view_unique_mode_per_action ON ir_act_window_view (act_window_id, view_mode)')
|
||||||
|
return res
|
||||||
act_window_view()
|
act_window_view()
|
||||||
|
|
||||||
class act_wizard(osv.osv):
|
class act_wizard(osv.osv):
|
||||||
|
|
|
@ -184,11 +184,12 @@ class ir_attachment(osv.osv):
|
||||||
}
|
}
|
||||||
|
|
||||||
def _auto_init(self, cr, context=None):
|
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',))
|
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = %s', ('ir_attachment_res_idx',))
|
||||||
if not cr.fetchone():
|
if not cr.fetchone():
|
||||||
cr.execute('CREATE INDEX ir_attachment_res_idx ON ir_attachment (res_model, res_id)')
|
cr.execute('CREATE INDEX ir_attachment_res_idx ON ir_attachment (res_model, res_id)')
|
||||||
cr.commit()
|
cr.commit()
|
||||||
|
return res
|
||||||
|
|
||||||
def check(self, cr, uid, ids, mode, context=None, values=None):
|
def check(self, cr, uid, ids, mode, context=None, values=None):
|
||||||
"""Restricts the access to an ir.attachment, according to referred model
|
"""Restricts the access to an ir.attachment, according to referred model
|
||||||
|
|
|
@ -868,10 +868,11 @@ class ir_model_data(osv.osv):
|
||||||
self.loads = self.pool.model_data_reference_ids
|
self.loads = self.pool.model_data_reference_ids
|
||||||
|
|
||||||
def _auto_init(self, cr, context=None):
|
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_index\'')
|
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'ir_model_data_module_name_index\'')
|
||||||
if not cr.fetchone():
|
if not cr.fetchone():
|
||||||
cr.execute('CREATE INDEX ir_model_data_module_name_index ON ir_model_data (module, name)')
|
cr.execute('CREATE INDEX ir_model_data_module_name_index ON ir_model_data (module, name)')
|
||||||
|
return res
|
||||||
|
|
||||||
@tools.ormcache()
|
@tools.ormcache()
|
||||||
def _get_id(self, cr, uid, module, xml_id):
|
def _get_id(self, cr, uid, module, xml_id):
|
||||||
|
|
|
@ -229,7 +229,7 @@ class ir_translation(osv.osv):
|
||||||
'Language code of translation item must be among known languages' ), ]
|
'Language code of translation item must be among known languages' ), ]
|
||||||
|
|
||||||
def _auto_init(self, cr, context=None):
|
def _auto_init(self, cr, context=None):
|
||||||
super(ir_translation, self)._auto_init(cr, context)
|
res = super(ir_translation, self)._auto_init(cr, context)
|
||||||
|
|
||||||
# FIXME: there is a size limit on btree indexed values so we can't index src column with normal btree.
|
# FIXME: there is a size limit on btree indexed values so we can't index src column with normal btree.
|
||||||
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = %s', ('ir_translation_ltns',))
|
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = %s', ('ir_translation_ltns',))
|
||||||
|
@ -253,6 +253,8 @@ class ir_translation(osv.osv):
|
||||||
cr.execute('CREATE INDEX ir_translation_ltn ON ir_translation (name, lang, type)')
|
cr.execute('CREATE INDEX ir_translation_ltn ON ir_translation (name, lang, type)')
|
||||||
cr.commit()
|
cr.commit()
|
||||||
|
|
||||||
|
return res
|
||||||
|
|
||||||
def _check_selection_field_value(self, cr, uid, field, value, context=None):
|
def _check_selection_field_value(self, cr, uid, field, value, context=None):
|
||||||
if field == 'lang':
|
if field == 'lang':
|
||||||
return
|
return
|
||||||
|
|
|
@ -41,10 +41,11 @@ class view_custom(osv.osv):
|
||||||
}
|
}
|
||||||
|
|
||||||
def _auto_init(self, cr, context=None):
|
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\'')
|
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'ir_ui_view_custom_user_id_ref_id\'')
|
||||||
if not cr.fetchone():
|
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)')
|
cr.execute('CREATE INDEX ir_ui_view_custom_user_id_ref_id ON ir_ui_view_custom (user_id, ref_id)')
|
||||||
|
return res
|
||||||
|
|
||||||
class view(osv.osv):
|
class view(osv.osv):
|
||||||
_name = 'ir.ui.view'
|
_name = 'ir.ui.view'
|
||||||
|
@ -161,10 +162,11 @@ class view(osv.osv):
|
||||||
]
|
]
|
||||||
|
|
||||||
def _auto_init(self, cr, context=None):
|
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\'')
|
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'ir_ui_view_model_type_inherit_id\'')
|
||||||
if not cr.fetchone():
|
if not cr.fetchone():
|
||||||
cr.execute('CREATE INDEX ir_ui_view_model_type_inherit_id ON ir_ui_view (model, inherit_id)')
|
cr.execute('CREATE INDEX ir_ui_view_model_type_inherit_id ON ir_ui_view (model, inherit_id)')
|
||||||
|
return res
|
||||||
|
|
||||||
def get_inheriting_views_arch(self, cr, uid, view_id, model, context=None):
|
def get_inheriting_views_arch(self, cr, uid, view_id, model, context=None):
|
||||||
"""Retrieves the architecture of views that inherit from the given view, from the sets of
|
"""Retrieves the architecture of views that inherit from the given view, from the sets of
|
||||||
|
@ -291,10 +293,11 @@ class view_sc(osv.osv):
|
||||||
}
|
}
|
||||||
|
|
||||||
def _auto_init(self, cr, context=None):
|
def _auto_init(self, cr, context=None):
|
||||||
super(view_sc, self)._auto_init(cr, context)
|
res = super(view_sc, self)._auto_init(cr, context)
|
||||||
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'ir_ui_view_sc_user_id_resource\'')
|
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'ir_ui_view_sc_user_id_resource\'')
|
||||||
if not cr.fetchone():
|
if not cr.fetchone():
|
||||||
cr.execute('CREATE INDEX ir_ui_view_sc_user_id_resource ON ir_ui_view_sc (user_id, resource)')
|
cr.execute('CREATE INDEX ir_ui_view_sc_user_id_resource ON ir_ui_view_sc (user_id, resource)')
|
||||||
|
return res
|
||||||
|
|
||||||
def get_sc(self, cr, uid, user_id, model='ir.ui.menu', context=None):
|
def get_sc(self, cr, uid, user_id, model='ir.ui.menu', context=None):
|
||||||
ids = self.search(cr, uid, [('user_id','=',user_id),('resource','=',model)], context=context)
|
ids = self.search(cr, uid, [('user_id','=',user_id),('resource','=',model)], context=context)
|
||||||
|
|
|
@ -190,10 +190,11 @@ class ir_values(osv.osv):
|
||||||
}
|
}
|
||||||
|
|
||||||
def _auto_init(self, cr, context=None):
|
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\'')
|
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'ir_values_key_model_key2_res_id_user_id_idx\'')
|
||||||
if not cr.fetchone():
|
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)')
|
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 set_default(self, cr, uid, model, field_name, value, for_all_users=True, company_id=False, condition=False):
|
def set_default(self, cr, uid, model, field_name, value, for_all_users=True, company_id=False, condition=False):
|
||||||
"""Defines a default value for the given model and field_name. Any previous
|
"""Defines a default value for the given model and field_name. Any previous
|
||||||
|
|
|
@ -139,13 +139,14 @@ class wkf_instance(osv.osv):
|
||||||
'state': fields.char('Status', size=32),
|
'state': fields.char('Status', size=32),
|
||||||
}
|
}
|
||||||
def _auto_init(self, cr, context=None):
|
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\'')
|
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'wkf_instance_res_type_res_id_state_index\'')
|
||||||
if not cr.fetchone():
|
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('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\'')
|
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'wkf_instance_res_id_wkf_id_index\'')
|
||||||
if not cr.fetchone():
|
if not cr.fetchone():
|
||||||
cr.execute('CREATE INDEX wkf_instance_res_id_wkf_id_index ON wkf_instance (res_id, wkf_id)')
|
cr.execute('CREATE INDEX wkf_instance_res_id_wkf_id_index ON wkf_instance (res_id, wkf_id)')
|
||||||
|
return res
|
||||||
|
|
||||||
wkf_instance()
|
wkf_instance()
|
||||||
|
|
||||||
|
@ -174,10 +175,11 @@ class wkf_triggers(osv.osv):
|
||||||
'workitem_id': fields.many2one('workflow.workitem', 'Workitem', required=True, ondelete="cascade"),
|
'workitem_id': fields.many2one('workflow.workitem', 'Workitem', required=True, ondelete="cascade"),
|
||||||
}
|
}
|
||||||
def _auto_init(self, cr, context=None):
|
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\'')
|
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'wkf_triggers_res_id_model_index\'')
|
||||||
if not cr.fetchone():
|
if not cr.fetchone():
|
||||||
cr.execute('CREATE INDEX wkf_triggers_res_id_model_index ON wkf_triggers (res_id, model)')
|
cr.execute('CREATE INDEX wkf_triggers_res_id_model_index ON wkf_triggers (res_id, model)')
|
||||||
|
return res
|
||||||
wkf_triggers()
|
wkf_triggers()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue