<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
        <record id="mail_activity_schedule_view_form" model="ir.ui.view">
            <field name="name">Activity schedule</field>
            <field name="model">mail.activity.schedule</field>
            <field name="arch" type="xml">
                <form>
                    <field name="activity_category" invisible="1"/>
                    <field name="chaining_type" invisible="1"/>
                    <field name="company_id" invisible="1"/>
                    <field name="has_error" invisible="1"/>
                    <field name="plan_has_user_on_demand" invisible="1"/>
                    <field name="res_ids" invisible="1"/>
                    <field name="plan_available_ids" invisible="1"/>
                    <header invisible="not bool(plan_available_ids)">
                        <group>
                            <field name="plan_id" options='{"no_open": True, "no_create": True}'/>
                        </group>
                    </header>
                    <sheet>
                        <group invisible="not plan_id">
                            <group>
                                <field name="plan_date_deadline"/>
                                <field name="plan_on_demand_user_id" widget="many2one_avatar_user"
                                       invisible="not plan_has_user_on_demand"/>
                            </group>
                            <group>
                                <label for="plan_assignation_summary" class="o_form_label"
                                       string="Plan summary" colspan="2"/>
                                <field name="plan_assignation_summary" colspan="2" nolabel="1"/>
                            </group>
                        </group>
                        <group invisible="plan_id">
                            <group>
                                <field name="res_model" invisible="1"/>
                                <field name="activity_type_id"
                                       required="not plan_id"
                                       options="{'no_create': True, 'no_open': True}"/>
                                <field name="summary" placeholder="e.g. Discuss proposal"/>
                            </group>
                            <group>
                                <field name="date_deadline"/>
                                <field name="activity_user_id" widget="many2one_avatar_user"
                                       required="not plan_id"/>
                            </group>
                            <field name="note" class="oe-bordered-editor" placeholder="Log a note..."/>
                        </group>
                        <div role="alert" class="alert alert-danger mb8" invisible="not has_error">
                            <field name="error"/>
                        </div>
                    </sheet>
                    <footer invisible="plan_id">
                        <button name="action_schedule_activities" string="Schedule" type="object" class="btn-primary"
                                invisible="has_error" data-hotkey="q"/>
                        <button name="action_schedule_activities_done" string="Schedule &amp; Mark as Done" type="object"
                                invisible="has_error or chaining_type == 'trigger'"
                                class="btn-secondary"  data-hotkey="w"
                                context="{'mail_activity_quick_update': True}"/>
                        <button name="action_schedule_activities_done_and_schedule" string="Done &amp; Schedule Next" type="object"
                                invisible="has_error or chaining_type == 'trigger'"
                                class="btn-secondary" data-hotkey="z"
                                context="{'mail_activity_quick_update': True}"/>
                        <button name="action_schedule_activities_done_and_schedule" string="Done &amp; Launch Next" type="object"
                                invisible="has_error or chaining_type == 'suggest'"
                                class="btn-secondary" data-hotkey="z"
                                context="{'mail_activity_quick_update': True}"/>
                        <button string="Cancel" class="btn-secondary" special="cancel" data-hotkey="x"/>
                    </footer>
                    <footer invisible="not plan_id">
                        <button name="action_schedule_plan" string="Schedule" type="object" class="btn-primary"
                                invisible="has_error" data-hotkey="q"/>
                        <button string="Cancel" class="btn-secondary" special="cancel" data-hotkey="x"/>
                    </footer>
                </form>
            </field>
        </record>
    </data>
</odoo>
