[CLEAN] Some code cleaning about context management

bzr revid: tde@openerp.com-20130515082939-oediun6cb9wd87lh
This commit is contained in:
Thibault Delavallée
2013-05-15 10:29:39 +02:00
parent 40f387e2d0
commit a027590d6e
2 changed files with 5 additions and 4 deletions
+3 -3
View File
@@ -265,12 +265,12 @@ class res_users(osv.Model):
self.pool.get('email.template').send_mail(cr, uid, template.id, user.id, True, context=context)
def create(self, cr, uid, values, context=None):
if context is None:
context = {}
# overridden to automatically invite user to sign up
user_id = super(res_users, self).create(cr, uid, values, context=context)
user = self.browse(cr, uid, user_id, context=context)
if user.email and (not context or not context.get('no_reset_password')):
if not context:
context = {}
if user.email and not context.get('no_reset_password'):
context.update({'create_user': True})
self.action_reset_password(cr, uid, [user.id], context=context)
return user_id
@@ -190,7 +190,8 @@ Thanks,''') % (name, self.pool.get('ir.config_parameter').get_param(cr, uid, 'we
'action_id': act_id[0],
'survey_id': [[6, 0, survey_ids]]
}
user = user_ref.create(cr, uid, res_data, {'no_reset_password': True})
create_ctx = dict(context, no_reset_password=True)
user = user_ref.create(cr, uid, res_data, context=create_ctx)
if user not in new_user:
new_user.append(user)
created+= "- %s (Login: %s, Password: %s)\n" % (partner.name or _('Unknown'),\