[FIX] _auto_init: return a value to _auto_init calls. Backport of trunk revision 8679
bzr revid: mat@openerp.com-20140107145142-zm48pcjvqp42cfjg
This commit is contained in:
commit
56dc173361
|
@ -562,10 +562,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)
|
||||
|
|
|
@ -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