<?xml version="1.0" encoding="utf-8"?>
<odoo>

    <record id="action_open_appointments" model="ir.actions.act_window">
        <field name="name">Appointments</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">hospital.appointment</field>
        <field name="view_mode">tree,form</field>
        <field name="domain">[('doctor_id','=', active_id)]</field>
        <field name="context">{'default_doctor_id': active_id}</field>
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
                Create your first appointment !
            </p>
        </field>
    </record>

    <record id="view_doctor_kanban" model="ir.ui.view">
        <field name="name">hospital.doctor.kanban</field>
        <field name="model">hospital.doctor</field>
        <field name="arch" type="xml">
            <kanban sample="1">
                <field name="id"/>
                <field name="doctor_name"/>
                <field name="gender"/>
                <field name="age"/>
                <field name="note"/>
                <templates>
                    <t t-name="kanban-box">
                        <div t-attf-class="oe_kanban_global_click">
                            <div class="oe_kanban_details">
                                <ul>
                                    <li>
                                        Name: <field name="doctor_name"/>
                                    </li>
                                    <li>
                                        Age: <field name="age"/>
                                    </li>
                                    <li>
                                        Gender: <field name="gender"/>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </t>
                </templates>
            </kanban>
        </field>
    </record>

    <record id="view_doctor_tree" model="ir.ui.view">
        <field name="name">hospital.doctor.tree</field>
        <field name="model">hospital.doctor</field>
        <field name="arch" type="xml">
            <tree sample="1">
                <field name="doctor_name"/>
                <field name="gender"/>
                <field name="age"/>
                <field name="note"/>
            </tree>
        </field>
    </record>

    <record id="view_doctor_form" model="ir.ui.view">
        <field name="name">hospital.doctor.form</field>
        <field name="model">hospital.doctor</field>
        <field name="arch" type="xml">
            <form>
                <sheet>
                    <div class="oe_button_box" name="button_box">
                        <button name="%(om_hospital.action_open_appointments)d" type="action"
                                class="oe_stat_button" icon="fa-calendar">
                            <div class="o_stat_info">
                                <field name="appointment_count" class="o_stat_value"/>
                                <span class="o_stat_text">Appointments</span>
                            </div>
                        </button>
                    </div>
                    <field name="image" widget="image" class="oe_avatar"/>
                    <group>
                        <group>
                            <field name="doctor_name"/>
                            <field name="age"/>
                        </group>
                        <group>
                            <field name="gender"/>
                            <field name="note"/>
                            <field name="active" invisible="1"/>
                        </group>
                    </group>
                </sheet>
                <div class="oe_chatter">
                    <field name="message_follower_ids"/>
                    <field name="activity_ids"/>
                    <field name="message_ids"/>
                </div>
            </form>
        </field>
    </record>

    <record id="view_doctor_search" model="ir.ui.view">
        <field name="name">hospital.doctor.search</field>
        <field name="model">hospital.doctor</field>
        <field name="arch" type="xml">
            <search string="Doctors">
                <field name="doctor_name"/>
                <field name="note"/>
                <separator/>
                <filter string="Male" name="male" domain="[('gender', '=', 'male')]"/>
                <filter string="Female" name="female" domain="[('gender', '=', 'female')]"/>
                <filter string="Others" name="other" domain="[('gender', '=', 'other')]"/>
                <separator/>
                <filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
                <group expand="1" string="Group By">
                    <filter string="Gender" name="gender" context="{'group_by':'gender'}"/>
                </group>
            </search>
        </field>
    </record>

    <record id="action_hospital_doctor" model="ir.actions.act_window">
        <field name="name">Doctors</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">hospital.doctor</field>
        <field name="view_mode">kanban,tree,form</field>
        <field name="context">{}</field>
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
                Create your first doctor!
            </p>
        </field>
    </record>

    <menuitem id="menu_doctor_root"
              name="Doctors"
              parent="menu_hospital_root"
              sequence="10"/>

    <menuitem id="menu_doctor"
              name="Doctors"
              parent="menu_doctor_root"
              action="action_hospital_doctor"
              sequence="10"/>

</odoo>