<?xml version="1.0"?>
<openerp>
    <data>
    # ------------------------------------------------------ 
    # Meetings
    # ------------------------------------------------------ 

    <record model="ir.ui.view" id="crm_case_form_view_meet">
        <field name="name">CRM - Meetings Form</field>
        <field name="model">crm.case</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Meetings Form">
                <group colspan="4" col="6">
                    <field name="name" select="1" string="Title"/>
                    <field name="section_id"/>
                    <field name="user_id" select="2" string="Responsible" required="1"/>
                    <newline/>
                    <field name="date" string="Meeting Date" required="1"/>
                    <field name="duration" colspan="1" widget="float_time" required="1"/>
                    <field name="case_id" on_change="onchange_case_id(case_id, name, partner_id)"/>
                </group>
                <notebook colspan="4">
                <page string="Meeting">
                    <field name="partner_id" on_change="onchange_partner_id(partner_id, email_from)" />
                    <field name="partner_address_id" on_change="onchange_partner_address_id(partner_address_id, email_from)"/>
                    <field name="email_from"/>
                    <newline/>
                    <field name="categ_id" select="2" on_change="onchange_categ_id(categ_id)"/>
                    <field name="category2_id" select="1" string="Location"/>
                    <separator string="Description" colspan="4"/>
                    <field name="note"  nolabel="1" colspan="4" />
                    <separator colspan="4"/>
                    <group col="8" colspan="4">
                        <field name="state" select="2"/> 
                        <button name="case_open" string="Confirm Meeting" states="draft,cancel,pending" type="object"/>
                        <button name="case_cancel" string="Cancel Meeting" states="draft,open,pending" type="object"/>
                        <button name="case_reset" string="Reset to Unconfirmed" states="done,open,cancel" type="object"/>
                    </group>
                </page>
                <page string="Extra Info">
                    <group colspan="4">
                        <field name="id" select="2"/>
                        <field name="active" select="2"/>
                        <newline/>
                        <field name="email_cc" colspan="1"/>
                        <field name="date_deadline" select="2" string="Deadlines"/>
                        <field name="priority" select="2"/>
                        <newline/>

                        <field name="planned_revenue"/>
                        <field name="planned_cost"/>
                        <field name="probability"/>
                        <separator colspan="4" string="Dates"/>
                        <field name="create_date"/>
                        <field name="date_closed"/>
                        <field name="date_action_last"/>
                        <field name="date_action_next"/>
                    </group>
                    <separator colspan="4"/>
                    <field name="history_line" colspan="2" nolabel="1" mode="tree,form">
                        <form string="Communication history">
                            <group col="6" colspan="4">
                                <field name="date"/>
                                <field name="email"/>
                                <field name="canal_id"/>
                            </group>
                            <newline/>
                            <field name="description" colspan="4" nolabel="1"/>
                        </form>
                        <tree string="Communication history">
                            <field name="description"/>
                            <field name="email"/>
                            <field name="date"/>
                        </tree>
                    </field>
                    <group col="2" colspan="2" expand="1">
                        <field name="canal_id"/>
                        <field name="som"/>
                        <button name="add_reply" string="Add Last Mail for Replying"
                            states="open" type="object" colspan="2"/>
                        <field name="description" colspan="2" nolabel="1"/>
                        <button name="case_log_reply"
                            string="Send Partner &amp; Historize" states="open"
                            type="object"/>
                        <button name="case_log" string="Historize" states="open"
                            type="object"/>
                    </group>
                    
                    <separator colspan="4" string="References"/>
                    <field name="ref" colspan="4"/>
                    <field name="ref2" colspan="4"/>
                </page>
                <page string="History">
                    <field name="log_ids" nolabel="1" colspan="4">
                        <form string="Actions">
                            <separator string="Action Information" colspan="4"/>
                            <field name="name" colspan="4"/>
                            <field name="date"/>
                            <field name="user_id"/>
                            <field name="som"/>
                            <field name="canal_id"/>
                        </form>
                    </field>
                </page>
                </notebook>
            </form>
        </field>
    </record>
    <record model="ir.ui.view" id="crm_case_tree_view_meet">
        <field name="name">CRM - Meetings Tree</field>
        <field name="model">crm.case</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree string="Meetings Tree"  colors="red:state=='open'">
                <field name="id"/>
                <field name="name" string="Title"/>
                <field name="date" string="Next Meeting"/>
                <field name="section_id"/>
                <field name="priority"/>
                <field name="categ_id"/>
                <field name="category2_id" string="Type"/>
                <field name="user_id"/>
                <field name="state"/>
            </tree>
        </field>
    </record>
    <record model="ir.ui.view" id="crm_case_calendar_view_meet">
        <field name="name">CRM - Meetings Calendar</field>
        <field name="model">crm.case</field>
        <field name="type">calendar</field>
        <field name="priority" eval="2"/>
        <field name="arch" type="xml">
            <calendar string="Meetings" date_start="date" color="user_id" date_delay="duration">
                <field name="name"/>
                <field name="partner_id"/>
                <field name="section_id"/>
            </calendar>
        </field>
    </record>
    </data>
</openerp>
