[IMP] auth_signup: avoid disabled users to fail an installation

When a module creates a disabled user during its installation or upgrade
(e.g. demo data), the UserError "You cannot perform this action on an
archived user" breaks the whole installation process.

We don't care if the mail cannot be sent for users created by an
installation, so let's just skip the whole function if we are installing
a module.

closes odoo/odoo#59036

X-original-commit: 78e22584c76c9fecbc22ab3604771fdce5f2094f
Signed-off-by: Paul Morelle <madprog@users.noreply.github.com>
This commit is contained in:
Paul Morelle
2020-10-02 17:50:16 +00:00
parent 0b1ff86f24
commit 0c7d16963b
+2
View File
@@ -164,6 +164,8 @@ class ResUsers(models.Model):
def action_reset_password(self):
""" create signup token for each user, and send their signup url by email """
if self.env.context.get('install_mode', False):
return
if self.filtered(lambda user: not user.active):
raise UserError(_("You cannot perform this action on an archived user."))
# prepare reset password signup