diff options
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> |
