[FIX] _auto_init(): when _auto_init() is overridden it does not return the super() result, which might brake functional fields initialization.
bzr revid: vmt@openerp.com-20130417075546-e3crirzk1trl9yr1
This commit is contained in:
parent
d248aa30ba
commit
9541529215
|
@ -559,10 +559,11 @@ class account_move_line(osv.osv):
|
|||
]
|
||||
|
||||
def _auto_init(self, cr, context=None):
|
||||
super(account_move_line, self)._auto_init(cr, context=context)
|
||||
res = super(account_move_line, self)._auto_init(cr, context=context)
|
||||
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'account_move_line_journal_id_period_id_index\'')
|
||||
if not cr.fetchone():
|
||||
cr.execute('CREATE INDEX account_move_line_journal_id_period_id_index ON account_move_line (journal_id, period_id)')
|
||||
return res
|
||||
|
||||
def _check_no_view(self, cr, uid, ids, context=None):
|
||||
lines = self.browse(cr, uid, ids, context=context)
|
||||
|
|
|
@ -510,8 +510,9 @@ class hr_job(osv.osv):
|
|||
|
||||
def _auto_init(self, cr, context=None):
|
||||
"""Installation hook to create aliases for all jobs and avoid constraint errors."""
|
||||
self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(hr_job,self)._auto_init,
|
||||
res = self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(hr_job,self)._auto_init,
|
||||
self._columns['alias_id'], 'name', alias_prefix='job+', alias_defaults={'job_id': 'id'}, context=context)
|
||||
return res
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
mail_alias = self.pool.get('mail.alias')
|
||||
|
|
|
@ -160,7 +160,7 @@ class mail_alias(osv.Model):
|
|||
alias_id_column.required = False
|
||||
|
||||
# call _auto_init
|
||||
child_model_auto_init_fct(cr, context=context)
|
||||
res = child_model_auto_init_fct(cr, context=context)
|
||||
|
||||
registry = RegistryManager.get(cr.dbname)
|
||||
mail_alias = registry.get('mail.alias')
|
||||
|
@ -188,6 +188,8 @@ class mail_alias(osv.Model):
|
|||
# set back the unique alias_id constraint
|
||||
alias_id_column.required = True
|
||||
|
||||
return res
|
||||
|
||||
def create_unique_alias(self, cr, uid, vals, model_name=None, context=None):
|
||||
"""Creates an email.alias record according to the values provided in ``vals``,
|
||||
with 2 alterations: the ``alias_name`` value may be suffixed in order to
|
||||
|
|
|
@ -60,8 +60,9 @@ class res_users(osv.Model):
|
|||
def _auto_init(self, cr, context=None):
|
||||
""" Installation hook: aliases, partner following themselves """
|
||||
# create aliases for all users and avoid constraint errors
|
||||
self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(res_users, self)._auto_init,
|
||||
res = self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(res_users, self)._auto_init,
|
||||
self._columns['alias_id'], 'login', alias_force_key='id', context=context)
|
||||
return res
|
||||
|
||||
def create(self, cr, uid, data, context=None):
|
||||
# create default alias same as the login
|
||||
|
|
Loading…
Reference in New Issue