From 35b9ff71465b04f8c1a6a1eb26d20c0ff37bdefd Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 2 Oct 2015 16:32:55 +0200 Subject: [PATCH] [FIX] auth_signup: do not send email to duplicated user When duplicating a user, an email was sent to a user at the email of the previous user (as the create is called before changing the email). Closes #8754 --- addons/auth_signup/res_users.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/auth_signup/res_users.py b/addons/auth_signup/res_users.py index b896e92558d..e393af29ba9 100644 --- a/addons/auth_signup/res_users.py +++ b/addons/auth_signup/res_users.py @@ -279,3 +279,9 @@ class res_users(osv.Model): ctx = dict(context, create_user=True) self.action_reset_password(cr, uid, [user.id], context=ctx) return user_id + + def copy(self, cr, uid, id, default=None, context=None): + if not default or not default.get('email'): + # avoid sending email to the user we are duplicating + context = dict(context or {}, reset_password=False) + return super(res_users, self).copy(cr, uid, id, default=default, context=context)