From 32ec8a974ddd8715bd76faf7a2d95e4a870c6132 Mon Sep 17 00:00:00 2001 From: Nidhi Patel Date: Wed, 11 Mar 2020 05:31:15 +0000 Subject: [PATCH] [IMP] auth_signup: Allow to send reset password instructions to multi users Currently,the action_reset_password is only available at form view of res.user under the 'Send reset password instructions' button. The purpose of this task is to allow admins to send password reset instructions to multiple users at once from list view. In this commit, we make action_reset_password available in the action menu of list view with label 'Send password reset instructions' and relabel the form view button to 'Send password reset instructions'. As when the user is created at that time it will send the 'accept invitation' mail so here from list view we will always send the 'change password' mail even user is never connected(state='new'). closes odoo/odoo#47454 Taskid: 2076526 Closes: #47454 Signed-off-by: Yannick Tivisse (yti) --- addons/auth_signup/models/res_users.py | 2 ++ addons/auth_signup/views/res_users_views.xml | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/addons/auth_signup/models/res_users.py b/addons/auth_signup/models/res_users.py index dc7d15f2997..dc1a471421a 100644 --- a/addons/auth_signup/models/res_users.py +++ b/addons/auth_signup/models/res_users.py @@ -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.filtered(lambda user: not user.active): + raise UserError(_("You cannot perform this action on an archived user.")) # prepare reset password signup create_mode = bool(self.env.context.get('create_user')) diff --git a/addons/auth_signup/views/res_users_views.xml b/addons/auth_signup/views/res_users_views.xml index b34b0ac832f..7209d3cfed9 100644 --- a/addons/auth_signup/views/res_users_views.xml +++ b/addons/auth_signup/views/res_users_views.xml @@ -8,7 +8,7 @@ -