[FIX] migrate_to_alias() of mail.alias didn't care about result value of _auto_init
bzr revid: cto@openerp.com-20140106133600-o7a2p3pr1zlvjezb
This commit is contained in:
parent
df0a13ab4c
commit
dabb11ab88
|
@ -479,7 +479,7 @@ class hr_job(osv.osv):
|
|||
if context is None:
|
||||
context = {}
|
||||
alias_context = dict(context, alias_model_name='hr.applicant')
|
||||
self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(hr_job, self)._auto_init,
|
||||
return 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=alias_context)
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
|
|
|
@ -157,7 +157,7 @@ class mail_alias(osv.Model):
|
|||
alias_id_column.required = False
|
||||
|
||||
# call _auto_init
|
||||
child_model_auto_init_fct(cr, context=context)
|
||||
result = child_model_auto_init_fct(cr, context=context)
|
||||
|
||||
registry = RegistryManager.get(cr.dbname)
|
||||
mail_alias = registry.get('mail.alias')
|
||||
|
@ -185,6 +185,8 @@ class mail_alias(osv.Model):
|
|||
# set back the unique alias_id constraint
|
||||
alias_id_column.required = True
|
||||
|
||||
return result
|
||||
|
||||
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,7 +60,7 @@ 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,
|
||||
return 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)
|
||||
|
||||
def create(self, cr, uid, data, context=None):
|
||||
|
|
|
@ -83,7 +83,7 @@ class project(osv.osv):
|
|||
""" Installation hook: aliases, project.project """
|
||||
# create aliases for all projects and avoid constraint errors
|
||||
alias_context = dict(context, alias_model_name='project.task')
|
||||
self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(project, self)._auto_init,
|
||||
return self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(project, self)._auto_init,
|
||||
self._columns['alias_id'], 'id', alias_prefix='project+', alias_defaults={'project_id':'id'}, context=alias_context)
|
||||
|
||||
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
|
||||
|
|
Loading…
Reference in New Issue