<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
    	<menuitem name="Requests" id="menu_resquest_ref" parent="base.next_id_4" sequence="1"/>

        <record id="res_request_tree-view" model="ir.ui.view">
            <field name="name">res.request.tree</field>
            <field name="model">res.request</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Requests" colors="blue:state in ('waiting');gray:state in ('closed')">
                    <field name="create_date"/>
                    <field name="act_from"/>
                    <field name="act_to"/>
                    <field name="name"/>
                    <field name="priority"/>
                    <field name="trigger_date"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>
        <record id="res_request-view" model="ir.ui.view">
            <field name="name">res.request.form</field>
            <field name="model">res.request</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Requests">
                    <group colspan="4" col="6">
	                    <field name="name" colspan="4"/>
	                    <field name="create_date" string="Request Date"/>
	                    <newline/>
	                	<field name="act_from"/>
	                	<field name="priority"/>
	                	<field name="active"/>
	                </group>
                    <notebook colspan="4">
                        <page string="Request">
                            <field name="act_to"/>
                            <field name="trigger_date"/>
                            <separator colspan="4" string="Description"/>
                            <newline/>
                            <field colspan="4" name="body" nolabel="1"/>
                            <group col="5" colspan="4">
                                <field name="state"/>
                                <button name="request_close" states="waiting,draft,active" string="Close" type="object" icon="gtk-close"/>
                                <button name="request_send" states="draft,active" string="Send" type="object" icon="terp-camera_test"/>
                                <button name="request_reply" states="waiting" string="Reply" type="object" icon="gtk-undo"/>
                            </group>
                        </page>
                        <page string="References" groups="base.group_extended">
                            <field name="ref_partner_id"/>
                            <field colspan="4" name="ref_doc1"/>
                            <field colspan="4" name="ref_doc2"/>
                        </page>
                        <page string="History" groups="base.group_extended">
                            <field colspan="4" name="history" nolabel="1" widget="one2many_list"/>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>
        <record model="ir.ui.view" id="res_request_calendar_view">
            <field name="name">Request - Calendar</field>
            <field name="model">res.request</field>
            <field name="type">calendar</field>
            <field name="priority" eval="2"/>
            <field name="arch" type="xml">
                <calendar string="Requests" date_start="trigger_date" color="act_to">
                    <field name="name"/>
                    <field name="act_from"/>
                </calendar>
            </field>
        </record>
        <record id="res_request_search_view" model="ir.ui.view">
            <field name="name">res.request.search</field>
            <field name="model">res.request</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Requests">
                    <filter string="Current" icon="terp-camera_test" domain="['|',('state','=','draft'),('state','=','active')]"
                    help="Draft and Active"/>
                    <separator orientation="vertical"/>
                    <filter string="Waiting" icon="terp-gtk-media-pause" domain="[('state','=','waiting')]"/>
                    <separator orientation="vertical"/>
                    <field name="act_from"/>
                    <field name="act_to" select="1"/>
                    <field name="name"/>
                    <field name="state"/>
	                <newline/>
	                <group expand="0" string="Group By" colspan="4">
                        <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
	                </group>
                </search>
            </field>
        </record>
        <record id="res_request_calendar_view" model="ir.ui.view">
            <field name="name">res.request.calendar</field>
            <field name="model">res.request</field>
            <field name="type">calendar</field>
            <field name="arch" type="xml">
                <calendar string="Requests" date_start="create_date" color="act_to">
                    <field name="name"/>
                    <field name="act_to"/>
                </calendar>
            </field>
        </record>
        <record id="res_request-act" model="ir.actions.act_window">
            <field name="name">Requests</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">res.request</field>
            <field name="view_id" eval="False"/>
            <field name="view_mode">tree,form,calendar</field>
            <field name="search_view_id" ref="res_request_search_view"/>
            <field name="context">{"search_default_act_to":uid}</field>
        </record>
        <menuitem action="res_request-act" id="menu_res_request_act" parent="menu_resquest_ref" />

        <record id="res_request_link-view" model="ir.ui.view">
            <field name="name">res.request.link.form</field>
            <field name="model">res.request.link</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Request Link">
                    <field name="name"/>
                    <field name="object"/>
                    <field name="priority"/>
                </form>
            </field>
        </record>
        <record id="res_request_link_tree-view" model="ir.ui.view">
            <field name="name">res.request.link.form</field>
            <field name="model">res.request.link</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Request Link">
                    <field name="name"/>
                    <field name="object"/>
                </tree>
            </field>
        </record>
        <record id="res_request_link_search_view" model="ir.ui.view">
            <field name="name">res.request.link.search</field>
            <field name="model">res.request.link</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Request Link">
                    <field name="name"/>
                    <field name="object"/>
                </search>
            </field>
        </record>

        <record id="res_request_link-act" model="ir.actions.act_window">
            <field name="name">Request Reference Types</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">res.request.link</field>
            <field name="view_type">form</field>
            <field name="view_id" eval="False"/>
            <field name="search_view_id" ref="res_request_link_search_view"/>
        </record>
        <menuitem action="res_request_link-act" id="menu_res_request_link_act" parent="menu_resquest_ref" />




        <record id="res_request_history_tree-view" model="ir.ui.view">
            <field name="name">res.request.history.tree</field>
            <field name="model">res.request.history</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Request History">
                    <field name="act_from"/>
                    <field name="act_to"/>
                    <field name="date_sent"/>
                    <field name="name"/>
                </tree>
            </field>
        </record>

        <record id="res_request_history_form-view" model="ir.ui.view">
            <field name="name">res.request.history.form</field>
            <field name="model">res.request.history</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Request History">
                    <field name="act_from"/>
                    <field name="act_to"/>
                    <field name="date_sent"/>
                    <newline/>
                    <field colspan="4" name="body"/>
                </form>
            </field>
        </record>
    </data>
</openerp>
