<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>

        <record id="res_users_form_view" model="ir.ui.view">
            <field name="name">user.form.state</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="//sheet" position="before">
                    <header>
                        <field name="state" widget="statusbar"/>
                    </header>
                    <div class="oe_form_box_info oe_text_center" attrs="{'invisible': [('signup_valid', '!=', True)]}">
                        <p attrs="{'invisible': [('state', '!=', 'active')]}">
                            <b>A password reset has been requested for this user. An email containing the following link has been sent:</b>
                        </p>
                        <p attrs="{'invisible': [('state', '!=', 'new')]}">
                            <b>An invitation email containing the following subscription link has been sent:</b>
                        </p>
                        <p><field class="oe_inline" name="signup_url" widget="url"/></p>
                        <field name="signup_valid" invisible="1"/>
                    </div>
                </xpath>
                <!-- add Reset Password button -->
                <xpath expr="//div[@class='oe_right oe_button_box']//button" position="replace">
                        <button string="Send Reset Password Instructions"
                                class="oe_link"
                                type="object" name="action_reset_password"
                                attrs="{'invisible': [('state', '!=', 'active')]}"/>
                        <button string="Send an Invitation Email"
                                class="oe_link"
                                type="object" name="action_reset_password" context="{'create_user': 1}"
                                attrs="{'invisible': [('state', '!=', 'new')]}"/>
                </xpath>
            </field>
        </record>

    </data>
</openerp>
