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>
60 lines
3.1 KiB
XML
60 lines
3.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
|
|
<record id="res_users_view_form" model="ir.ui.view">
|
|
<field name="name">res.users.form.inherit</field>
|
|
<field name="model">res.users</field>
|
|
<field name="inherit_id" ref="base.view_users_form"/>
|
|
<field name="arch" type="xml">
|
|
<!-- add state field in header -->
|
|
<xpath expr="//header" position="inside">
|
|
<button string="Send Password Reset Instructions"
|
|
type="object" name="action_reset_password"
|
|
attrs="{'invisible': [('state', '!=', 'active')]}"/>
|
|
<button string="Send an Invitation Email"
|
|
type="object" name="action_reset_password" context="{'create_user': 1}"
|
|
attrs="{'invisible': [('state', '!=', 'new')]}"/>
|
|
<field name="state" widget="statusbar"/>
|
|
</xpath>
|
|
|
|
<xpath expr="//sheet" position="before">
|
|
<div class="alert alert-success text-center o_form_header" attrs="{'invisible': [('signup_valid', '!=', True)]}" role="status">
|
|
<a class="close" data-dismiss="alert" href="#" aria-label="Close">x</a>
|
|
<div attrs="{'invisible': [('state', '!=', 'active')]}">
|
|
<strong>A password reset has been requested for this user. An email containing the following link has been sent:</strong>
|
|
</div>
|
|
<div attrs="{'invisible': [('state', '!=', 'new')]}">
|
|
<strong>An invitation email containing the following subscription link has been sent:</strong>
|
|
</div>
|
|
<div><field name="signup_url" widget="url"/></div>
|
|
<field name="signup_valid" invisible="1"/>
|
|
</div>
|
|
</xpath>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="view_users_state_tree" model="ir.ui.view">
|
|
<field name="name">res.users.tree.inherit</field>
|
|
<field name="model">res.users</field>
|
|
<field name="inherit_id" ref="base.view_users_tree"/>
|
|
<field name="arch" type="xml">
|
|
<xpath expr="//tree" position="attributes">
|
|
<attribute name="decoration-info">state == 'new'</attribute>
|
|
</xpath>
|
|
<xpath expr="//field[@name='login_date']" position="after">
|
|
<field name="state" invisible="1"/>
|
|
</xpath>
|
|
</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>
|