<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
    <record id="view_res_users_key_tree" model="ir.ui.view">
        <field name="model">res.users.key</field>
        <field name="arch" type="xml">
            <tree editable="bottom">
                <field name="current" readonly="1" />
                <field name="fingerprint" readonly="1" />
            </tree>
        </field>
    </record>

    <record id="view_res_users_key_form" model="ir.ui.view">
        <field name="model">res.users.key</field>
        <field name="arch" type="xml">
            <form>
                <sheet>
                    <group>
                        <field name="fingerprint" readonly="1" />
                    </group>
                </sheet>
            </form>
        </field>
    </record>

    <record id="view_users_form_keys_modif" model="ir.ui.view">
        <field name="model">res.users</field>
        <field name="arch" type="xml">
            <form>
                <sheet>
                    <group>
                        <field name="inbox_link" widget="url" />
                        <field name="inbox_enabled" />
                    </group>

                    <field name="keys" />
                </sheet>
                <footer>
                    <button
                        name="vault_generate_key"
                        string="New private key"
                        class="btn-primary"
                    />
                    <button
                        name="action_new_inbox_token"
                        type="object"
                        string="New inbox link"
                        class="btn-primary"
                    />
                    <button
                        name="action_invalidate_key"
                        type="object"
                        string="Invalidate private key"
                        class="btn-secondary"
                        confirm="You will loose access to all vaults and your inbox. Do you want to continue?"
                    />
                    <button special="cancel" string="Cancel" class="btn-secondary" />
                </footer>
            </form>
        </field>
    </record>


    <record id="action_res_users_keys" model="ir.actions.act_window">
        <field name="name">Manage my keys</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">res.users</field>
        <field name="target">new</field>
        <field name="view_mode">form</field>
    </record>

    <record id="action_res_users_keys_view" model="ir.actions.act_window.view">
        <field eval="10" name="sequence" />
        <field name="view_mode">form</field>
        <field name="view_id" ref="view_users_form_keys_modif" />
        <field name="act_window_id" ref="action_res_users_keys" />
    </record>
</odoo>
