diff options
| author | Nidhi Patel <nia@odoo.com> | 2020-03-11 05:31:15 +0000 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2020-03-23 09:16:22 +0000 |
| commit | 32ec8a974ddd8715bd76faf7a2d95e4a870c6132 (patch) | |
| tree | 6574cc9a64c154d19c549774dfac50954115de7f /addons/auth_signup | |
| parent | fad3ed7ce4828275e92e8f748dbb7cdc4156fb57 (diff) | |
[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) <yti@odoo.com>
Diffstat (limited to 'addons/auth_signup')
| -rw-r--r-- | addons/auth_signup/models/res_users.py | 2 | ||||
| -rw-r--r-- | addons/auth_signup/views/res_users_views.xml | 11 |
2 files changed, 12 insertions, 1 deletions
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 @@ <field name="arch" type="xml"> <!-- add state field in header --> <xpath expr="//header" position="inside"> - <button string="Send Reset Password Instructions" + <button string="Send Password Reset Instructions" type="object" name="action_reset_password" attrs="{'invisible': [('state', '!=', 'active')]}"/> <button string="Send an Invitation Email" @@ -47,4 +47,13 @@ </field> </record> + <record id="action_send_password_reset_instructions" model="ir.actions.server"> + <field name="name">Send Password Reset Instructions</field> + <field name="model_id" ref="base.model_res_users"/> + <field name="groups_id" eval="[(4, ref('base.user_admin'))]"/> + <field name="binding_model_id" ref="base.model_res_users" /> + <field name="state">code</field> + <field name="code">records.action_reset_password()</field> + </record> + </odoo> |
