[FIX] gamification: stop notifying users on intermediate ranks

Purpose
=======
Avoid sending lost of emails for new ranks rank for each user when
installing gamification module.

Emails are now only sent outside of module installation.

Task-2746929

X-original-commit: 5dc3b3ef794b78f18713b4bcf6254ab60d62eec4
Part-of: odoo/odoo#89463
This commit is contained in:
Fabio Barbero
2022-04-22 17:00:14 +02:00
parent 7ce480b7bb
commit c0dd1e4f91
+4
View File
@@ -180,6 +180,10 @@ WHERE sub.user_id IN %%s""" % {
"""
Method that can be called on a batch of users with the same new rank
"""
if self.env.context.get('install_mode', False):
# avoid sending emails in install mode (prevents spamming users when creating data ranks)
return
template = self.env.ref('gamification.mail_template_data_new_rank_reached', raise_if_not_found=False)
if template:
for u in self: