<?xml version="1.0"?>
<odoo>
    <data>
        <record id="action_res_users_my_fullpage" model="ir.actions.act_window">
            <!-- Like action_res_users_my, but in full page -->
            <field name="name">Change My Preferences</field>
            <field name="res_model">res.users</field>
            <field name="view_mode">form</field>
            <field name="path">my-preferences</field>
        </record>
        <record id="action_res_users_my_fullpage_view" model="ir.actions.act_window.view">
            <field eval="50" name="sequence"/>
            <field name="view_mode">form</field>
            <field name="view_id" ref="base.view_users_form_simple_modif"/>
            <field name="act_window_id" ref="mail.action_res_users_my_fullpage"/>
        </record>

        <!-- Update Preferences form !-->
        <record id="view_users_form_simple_modif_mail" model="ir.ui.view">
            <field name="name">res.users.preferences.form.mail</field>
            <field name="model">res.users</field>
            <field name="inherit_id" ref="base.view_users_form_simple_modif"/>
            <field name="arch" type="xml">
                <data>
                    <xpath expr="//group[@name='other_preferences']" position="inside">
                        <field name="notification_type" widget="radio" readonly="0" options="{'horizontal': true}"/>
                        <field name="outgoing_mail_server_id" invisible="1"/> <!-- Used by the mail_server_configurator_selection widget -->
                        <span class="o_form_label fw-bold" invisible="not has_external_mail_server">Outgoing Mail Server</span>
                        <field name="outgoing_mail_server_type"
                            nolabel="1"
                            string="Outgoing Mail Server"
                            widget="mail_server_configurator_selection"
                            invisible="not has_external_mail_server"/>
                    </xpath>
                    <field name="signature" position="attributes">
                        <attribute name="widget">html_mail</attribute>
                    </field>
                    <group name="calendar_preferences" position="inside">
                        <label for="out_of_office_from" string="Out-of-office" />
                        <div class="o_row">
                            <field name="out_of_office_from" widget="daterange" options="{'end_date_field': 'out_of_office_to', 'show_time': False}" placeholder="None planned"/>
                            <field name="out_of_office_to" invisible="1"/> <!-- otherwise it is visible, smort -->
                        </div>
                        <field name="out_of_office_message" string="" options="{'height': 112}" class="border border-secondary w-100" placeholder="Your out-of-office message..."/>
                    </group>
                </data>
            </field>
        </record>

        <!-- Update user form !-->
        <record id="view_users_form_mail" model="ir.ui.view">
            <field name="name">res.users.form.mail</field>
            <field name="model">res.users</field>
            <field name="inherit_id" ref="base.view_users_form"/>
            <field name="arch" type="xml">
                <data>
                    <xpath expr="//group[@name='other_preferences']" position="inside">
                        <field name="notification_type" widget="radio" invisible="share" options="{'horizontal': true}"/>
                        <field name="outgoing_mail_server_id" invisible="1"/> <!-- Used by the mail_server_configurator_selection widget -->
                        <span class="o_form_label fw-bold" invisible="not has_external_mail_server">Outgoing Mail Server</span>
                        <field name="outgoing_mail_server_type"
                            nolabel="1"
                            string="Outgoing Mail Server"
                            widget="mail_server_configurator_selection"
                            invisible="not has_external_mail_server"/>
                    </xpath>
                    <field name="signature" position="attributes">
                        <attribute name="widget">html_mail</attribute>
                    </field>
                    <group name="calendar_preferences" position="inside">
                        <label for="out_of_office_from" string="Out-of-office" />
                        <div class="o_row">
                            <field name="out_of_office_from" widget="daterange" options="{'end_date_field': 'out_of_office_to', 'show_time': False}" placeholder="None planned"/>
                            <field name="out_of_office_to" invisible="1"/> <!-- otherwise it is visible, smort -->
                        </div>
                        <field name="out_of_office_message" string="" options="{'height': 112}" class="border border-secondary w-100" placeholder="Your out-of-office message..."/>
                    </group>
                </data>
            </field>
        </record>
    </data>
</odoo>
