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

        <menuitem icon="terp-partner" id="base.menu_base_partner" name="Sales" sequence="0" 
            groups="base.group_sale_manager,base.group_sale_salesman"/>

        <menuitem id="base.menu_crm_config_lead" name="Leads &amp; Opportunities"
            parent="base.menu_base_config" sequence="1" groups="base.group_sale_manager"/>

        <menuitem id="base.menu_crm_config_opportunity" name="Opportunities"
            parent="base.menu_base_config" sequence="1" groups="base.group_sale_manager"/>

        <menuitem id="base.menu_sale_config_sales" name="Sales"
            parent="base.menu_base_config" sequence="0" groups="base.group_sale_manager"/>

        <menuitem id="menu_crm_config_phonecall" name="Phone Call"
            parent="base.menu_base_config" sequence="5" groups="base.group_extended"/>

        <menuitem id="base.next_id_64" name="Reporting"
            parent="base.menu_base_partner" sequence="11" />


        <!-- crm.case.channel -->
        <record id="crm_case_channel_view_tree" model="ir.ui.view">
            <field name="name">crm.case.channel.tree</field>
            <field name="model">crm.case.channel</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Channels">
                    <field name="name" select="1"/>
                    <field name="active" select="1"/>
                </tree>
            </field>
        </record>
        <record id="crm_case_channel_view_form" model="ir.ui.view">
            <field name="name">crm.case.channel.form</field>
            <field name="model">crm.case.channel</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Channel">
                    <field name="name" select="1"/>
                    <field name="active" select="1"/>
                </form>
            </field>
        </record>
        <record id="crm_case_channel_action" model="ir.actions.act_window">
            <field name="name">Channels</field>
            <field name="res_model">crm.case.channel</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="help">Track from where is coming your leads and opportunities by creating specific channels that will be maintained at the creation of a document in the system. Some examples of channels can be: Website, Phone Call, Reseller, etc.</field>
        </record>

        <menuitem action="crm_case_channel_action" id="menu_crm_case_channel" parent="base.menu_crm_config_lead" sequence="4"/>

        <!-- Case Sections Form View -->

        <record id="crm_case_section_view_form" model="ir.ui.view">
            <field name="name">crm.case.section.form</field>
            <field name="model">crm.case.section</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Sales Team">
                    <group col="6" colspan="4">
                        <field name="name" select="1" colspan="2"/>
                        <field name="parent_id" select="2" widget="selection"/>
                        <field name="code" select="1"/>
                        <newline/>
                        <field name="user_id" select="2"/>
                        <field name="resource_calendar_id" select="2" widget="selection"/>
                        <field name="active" select="2"/>
                    </group>
                    <notebook colspan="4">
                        <page string="Sales Team">
                            <group col="2" colspan="1">
                                <separator string="Mailgateway" colspan="2"/>
                                <field name="reply_to" select="2"/>
                            </group>
                            <group col="2" colspan="1">
                                <separator string="Configuration" colspan="2"/>
                                <field name="allow_unlink" select="2"/>
                                <field name="change_responsible"/>
                            </group>
                            <group col="1" colspan="4" groups="base.group_extended">
                                <separator string="Team Members" colspan="4"/>
                                <field name="member_ids" nolabel="1" colspan="4"   height="250"/>
                            </group>
                        </page>
                        <page string="Stages">
                            <separator string="Select stages for this Sales Team" colspan="4"/>
                            <field name="stage_ids" colspan="4" nolabel="1"/>
                        </page>
                        <page string="Notes">
                            <field name="note" select="1" colspan="4" nolabel="1"/>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>

        <!-- Case Sections Tree View -->

        <record id="crm_case_section_view_tree" model="ir.ui.view">
            <field name="name">crm.case.section.tree</field>
            <field name="model">crm.case.section</field>
            <field name="type">tree</field>
            <field name="field_parent">child_ids</field>
            <field name="arch" type="xml">
                <tree string="Sales Team">
                    <field name="name" select="1"/>
                    <field name="code" select="1"/>
                    <field name="user_id" select="1"/>
                </tree>
            </field>
        </record>

        <!-- Case Sections Action -->

        <record id="crm_case_section_act" model="ir.actions.act_window">
            <field name="name">Sales Teams</field>
            <field name="res_model">crm.case.section</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="crm_case_section_view_tree"/>
            <field name="help">Define a Sales Team to organize your different salesmen or sales departments into separate teams. Each team will work in its own list of opportunities, sales orders, etc. Each user can set a default team in his user preferences. The opportunities and sales order displayed, will automatically be filtered according to his team.</field>
        </record>

        <menuitem action="crm_case_section_act"
            id="menu_crm_case_section_act" sequence="4"
            parent="base.menu_sale_config_sales" />


        <!-- CRM Stage Tree View -->

        <record model="ir.ui.view" id="crm_case_stage_tree">
            <field name="name">crm.case.stage.tree</field>
            <field name="model">crm.case.stage</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Stages">
                    <field name="sequence"/>
                    <field name="name"/>
                    <field name="probability"/>
                </tree>
            </field>
        </record>

        <!-- CRM Stage Form View -->

        <record model="ir.ui.view" id="crm_case_stage_form">
            <field name="name">crm.case.stage.form</field>
            <field name="model">crm.case.stage</field>
            <field name="type">form</field>
            <field name="priority" eval="1"/>
            <field name="arch" type="xml">
                <form string="Stage">
                    <separator string="Stage Definition" colspan="4"/>
                    <field name="name" select="1"/>
                    <field name="sequence"/>
                    <field name="probability"/>
                    <group colspan="4" col="2" >
                        <field name="on_change"/>
                    </group>
                    <separator string="Requirements" colspan="4"/>
                    <field name="requirements" nolabel="1" colspan="4"/>
                    <field name="section_ids" invisible="1" colspan="4"/>
                </form>
            </field>
        </record>

        <!-- CRM Stage Action -->

        <record id="crm_case_stage_act" model="ir.actions.act_window">
            <field name="name">Stages</field>
            <field name="res_model">crm.case.stage</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="crm_case_stage_tree"/>
        </record>


     <!-- Case Categories Form View -->

        <record id="crm_case_categ-view" model="ir.ui.view">
            <field name="name">crm.case.categ.form</field>
            <field name="model">crm.case.categ</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Case Category">
                    <field name="name" select="1"/>
                    <field name="section_id" select="1"/>
                    <field name="object_id"  invisible="1" />
                </form>
            </field>
        </record>

        <!-- Case Categories Tree View -->

        <record id="crm_case_categ_tree-view" model="ir.ui.view">
            <field name="name">crm.case.categ.tree</field>
            <field name="model">crm.case.categ</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Case Category">
                    <field name="name"/>
                    <field name="section_id"/>
                </tree>
            </field>
        </record>

        <!-- Resource Type of case Tree View -->

        <record model="ir.ui.view" id="crm_case_resource_type_tree">
            <field name="name">crm.case.resource.type.tree</field>
            <field name="model">crm.case.resource.type</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Campaign">
                    <field name="name"/>
                    <field name="section_id"/>
                </tree>
            </field>
        </record>

        <!-- Resource Type of case Form View -->

        <record model="ir.ui.view" id="crm_case_resource_type_form">
            <field name="name">crm.case.resource.type.form</field>
            <field name="model">crm.case.resource.type</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Campaign">
                    <field name="name" select="1"/>
                    <field name="section_id" select="1" widget="selection"/>
                </form>
            </field>
        </record>

        <!-- Resource Type of case Action -->

        <record id="crm_case_resource_type_act" model="ir.actions.act_window">
            <field name="name">Campaigns</field>
            <field name="res_model">crm.case.resource.type</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="crm_case_resource_type_tree"/>
        </record>

         <menuitem action="crm_case_resource_type_act"
            id="menu_crm_case_resource_type_act" sequence="4"
            groups="base.group_extended"
            parent="base.menu_crm_config_lead" />

        <record id="crm_case_section_act_tree" model="ir.actions.act_window">
            <field name="name">Cases by Sales Team</field>
            <field name="res_model">crm.case.section</field>
            <field name="domain">[('parent_id','=',False)]</field>
            <field name="view_type">tree</field>
            <field name="view_id" ref="crm_case_section_view_tree"/>
        </record>

        <!-- Segmentation line Tree View  -->

        <record id="crm_segmentation_line_tree-view" model="ir.ui.view">
            <field name="name">crm.segmentation.line.tree</field>
            <field name="model">crm.segmentation.line</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Partner Segmentation Lines">
                    <field name="name"/>
                    <field name="expr_name"/>
                    <field name="expr_operator"/>
                    <field name="expr_value"/>
                    <field name="operator"/>
                </tree>
            </field>
        </record>

        <!-- Segmentation line Form View  -->

        <record id="crm_segmentation_line-view" model="ir.ui.view">
            <field name="name">crm.segmentation.line.form</field>
            <field name="model">crm.segmentation.line</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Partner Segmentation Lines">
                    <field colspan="4" name="name" select="1"/>
                    <group col="2" colspan="4">
                        <field name="expr_name"/>
                        <field name="expr_operator"/>
                        <field name="expr_value"/>
                    </group>
                    <newline/>
                    <field name="operator"/>
                </form>
            </field>
        </record>

        <!-- CRM Segmentation  Form View  -->

        <record id="crm_segmentation-view" model="ir.ui.view">
            <field name="name">crm.segmentation.form</field>
            <field name="model">crm.segmentation</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Partner Segmentation">
                    <group col="6" colspan="4">
                        <field name="name" select="1"/>
                        <field name="categ_id"/>
                        <field name="exclusif"/>
                    </group>
                    <notebook colspan="4">
                        <page string="Sales Purchase">
                            <field name="sales_purchase_active"/>
                            <separator colspan="4" string="State of Mind Computation"/>
                            <field name="som_interval"/>
                            <field name="som_interval_max"/>
                            <field name="som_interval_decrease"/>
                            <field name="som_interval_default"/>
                            <separator colspan="4" string="Segmentation Test"/>
                            <field colspan="4" name="segmentation_line" widget="one2many_list" nolabel="1"/>
                        </page>
                        <page string="Description">
                               <field colspan="4" name="description" nolabel="1"/>
                           </page>
                    </notebook>
                    <field name="state"/>
                    <group col="3" colspan="2">
                        <button name="process_start"
                            states="not running"
                            string="Compute Segmentation" type="object"
                            icon="gtk-execute" />
                        <button name="process_stop" states="running"
                            string="Stop Process" type="object"
                            icon="gtk-cancel" />
                        <button name="process_continue" states="running"
                            string="Continue Process" type="object"
                            icon="gtk-go-forward" />
                    </group>
                </form>
            </field>
        </record>

        <!-- CRM Segmentation  Tree View  -->

        <record id="crm_segmentation_tree-view" model="ir.ui.view">
            <field name="name">crm.segmentation.tree</field>
            <field name="model">crm.segmentation</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Partner Segmentations">
                    <field name="name"/>
                    <field name="description"/>
                    <field name="categ_id"/>
                </tree>
            </field>
        </record>

        <record id="crm_segmentation-act" model="ir.actions.act_window">
            <field name="name">Segmentation</field>
            <field name="res_model">crm.segmentation</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="crm_segmentation-view"/>
        </record>

        <record id="crm_segmentation_tree-act" model="ir.actions.act_window">
            <field name="name">Partners Segmentation</field>
            <field name="res_model">crm.segmentation</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="help">Create specific partner categories which you can assign to your partners to better manage your interactions with them. The segmentation tool is able to assign categories to partners according to criteria you set.</field>
        </record>

       <menuitem action="crm_segmentation_tree-act"
            id="menu_crm_segmentation-act"
            groups="base.group_extended" sequence="2"
            parent="base.menu_base_action_rule" />

        <record model="ir.ui.view" id="view_users_form_simple_modif_inherited1">
            <field name="name">view.users.form.crm.modif.inherited1</field>
            <field name="model">res.users</field>
            <field name="inherit_id" ref="base.view_users_form_simple_modif" />
            <field name="type">form</field>
            <field name="arch" type="xml">
                <group name="default_filters" position="inside">
                    <field name="context_section_id" completion="1"
                        widget="selection"
                        readonly="0"/>
                </group>
            </field>
        </record>

        <record id="view_users_form_simple_modif_inherited2" model="ir.ui.view">
                <field name="name">view.users.form.crm.modif.inherited2</field>
                <field name="model">res.users</field>
                <field name="type">form</field>
                <field name="inherit_id" ref="base.view_users_form"/>
                <field eval="18" name="priority"/>
                <field name="arch" type="xml">
                    <group name="default_filters" position="inside">
                        <field name="context_section_id" completion="1" widget="selection"/>
                    </group>
                </field>
        </record>

        <!-- menu for the working time -->
        <menuitem action="resource.action_resource_calendar_form" id="menu_action_resource_calendar_form" parent="resource.menu_resource_config" sequence="1"/>

    </data>
</openerp>
