[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>
This commit is contained in:
committed by
Yannick Tivisse
parent
fad3ed7ce4
commit
32ec8a974d
@@ -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'))
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user