summaryrefslogtreecommitdiff
path: root/addons/auth_signup/models/res_users.py
diff options
context:
space:
mode:
authorJason Van Malder <jvm@odoo.com>2020-01-22 09:59:29 +0000
committerJason Van Malder <jvm@odoo.com>2020-01-30 11:59:38 +0000
commitf99f4db134fae2d22ec3cc1cf98b189e253bd4c3 (patch)
tree407f249412536af3330012e3f25b2731ae4c06eb /addons/auth_signup/models/res_users.py
parent2ecbfddd6bf877c8fe1221e6bda6b88c4c3417ea (diff)
[FIX] auth_signup: fix email sent when testing an import
Issue - Contacts - Import a contact that will be a portal user - Test import Activation email sent Cause Testing an import do the whole process including sending an email because of force_send (email not rollbacked). Solution Check if we are testing the import. If yes, do not force send the email. So, the email will be rollbacked. OPW-2168868 closes odoo/odoo#44283 X-original-commit: f372334facd189d0a70268e7876511bf1f800a4a Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
Diffstat (limited to 'addons/auth_signup/models/res_users.py')
-rw-r--r--addons/auth_signup/models/res_users.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/auth_signup/models/res_users.py b/addons/auth_signup/models/res_users.py
index a1abd1c32b6..dc7d15f2997 100644
--- a/addons/auth_signup/models/res_users.py
+++ b/addons/auth_signup/models/res_users.py
@@ -197,7 +197,8 @@ class ResUsers(models.Model):
raise UserError(_("Cannot send email: user %s has no email address.") % user.name)
# TDE FIXME: make this template technical (qweb)
with self.env.cr.savepoint():
- template.send_mail(user.id, force_send=True, raise_exception=True)
+ force_send = not(self.env.context.get('import_file', False))
+ template.send_mail(user.id, force_send=force_send, raise_exception=True)
_logger.info("Password reset email sent for user <%s> to <%s>", user.login, user.email)
def send_unregistered_user_reminder(self, after_days=5):