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

        <!-- Top menu item -->
        <!--
            This menu item's purpose is to overwrite another one defined in
            the base module in order to set new groups.
        -->
        <menuitem name="Sales"
            id="base.menu_base_partner"
            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="80" 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 Calls"
            parent="base.menu_base_config" sequence="45" groups="base.group_sale_salesman"/>

        <!-- crm.tracking.medium -->
        <record id="crm_tracking_medium_view_tree" model="ir.ui.view">
            <field name="name">crm.tracking.medium.tree</field>
            <field name="model">crm.tracking.medium</field>
            <field name="arch" type="xml">
                <tree string="Channels">
                    <field name="name"/>
                    <field name="active"/>
                </tree>
            </field>
        </record>
        <record id="crm_tracking_medium_view_form" model="ir.ui.view">
            <field name="name">crm.tracking.medium.form</field>
            <field name="model">crm.tracking.medium</field>
            <field name="arch" type="xml">
                <form string="Channel">
                    <group>
                        <field name="name"/>
                        <field name="active"/>
                    </group>
                </form>
            </field>
        </record>
        <record id="crm_tracking_medium_action" model="ir.actions.act_window">
            <field name="name">Channels</field>
            <field name="res_model">crm.tracking.medium</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to define a new channel.
              </p><p>
                Use channels to track the type of source of your leads and opportunities. Channels
                are mostly used in reporting to analyse sales performance
                related to marketing efforts.
              </p><p>
                Some examples of channels: company website, phone call
                campaign, reseller, banner, etc.
              </p>
            </field>
        </record>

        <!-- crm.tracking.source -->
        <record id="crm_tracking_source_view_tree" model="ir.ui.view">
            <field name="name">crm.tracking.source.tree</field>
            <field name="model">crm.tracking.source</field>
            <field name="arch" type="xml">
                <tree string="Channels">
                    <field name="name"/>
                </tree>
            </field>
        </record>
        <record id="crm_tracking_source_view_form" model="ir.ui.view">
            <field name="name">crm.tracking.source.form</field>
            <field name="model">crm.tracking.source</field>
            <field name="arch" type="xml">
                <form string="Channel">
                    <group>
                        <field name="name"/>
                    </group>
                </form>
            </field>
        </record>
        <record id="crm_tracking_source_action" model="ir.actions.act_window">
            <field name="name">Source</field>
            <field name="res_model">crm.tracking.source</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to define a new source.
              </p><p>
                Use channels to track the source of your leads and opportunities. Channels
                are mostly used in reporting to analyse sales performance
                related to marketing efforts.
              </p><p>
                Some examples of channels: partner's website, google.com, 
                email list name, etc.
              </p>
            </field>
        </record>

        <menuitem action="crm_tracking_source_action" id="menu_crm_tracking_source" parent="base.menu_crm_config_lead" sequence="4" groups="base.group_no_one"/>

        <!-- 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="arch" type="xml">
                <tree string="Stages">
                    <field name="sequence" widget="handle"/>
                    <field name="name"/>
                    <field name="probability"/>
                    <field name="type"/>
                </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="priority" eval="1"/>
            <field name="arch" type="xml">
                <form string="Stage">
                    <group>
                        <group>
                            <field name="name"/>
                            <field name="sequence"/>
                            <field name="type"/>
                            <field name="probability"/>
                        </group>
                        <group>
                            <field name="fold"/>
                            <field name="on_change"/>
                            <field name="case_default" groups="base.group_multi_salesteams"/>
                        </group>

                    </group>
                    <separator string="Requirements"/>
                    <field name="requirements" nolabel="1"/>
                    <field name="section_ids" invisible="1"/>
                </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="arch" type="xml">
                <form string="Case Category">
                    <group>
                        <field name="name"/>
                        <field name="section_id" groups="base.group_multi_salesteams"/>
                        <field name="object_id" invisible="1"/>
                    </group>
                </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="arch" type="xml">
                <tree string="Case Category">
                    <field name="name"/>
                    <field name="section_id" groups="base.group_multi_salesteams"/>
                </tree>
            </field>
        </record>

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

        <record model="ir.ui.view" id="crm_tracking_campaign_tree">
            <field name="name">crm.tracking.campaign.tree</field>
            <field name="model">crm.tracking.campaign</field>
            <field name="arch" type="xml">
                <tree string="Campaign">
                    <field name="name"/>
                    <field name="section_id" groups="base.group_multi_salesteams"/>
                </tree>
            </field>
        </record>

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

        <record model="ir.ui.view" id="crm_tracking_campaign_form">
            <field name="name">crm.tracking.campaign.form</field>
            <field name="model">crm.tracking.campaign</field>
            <field name="arch" type="xml">
                <form string="Campaign">
                    <group>
                        <field name="name"/>
                        <field name="section_id" groups="base.group_multi_salesteams"/>
                    </group>
                </form>
            </field>
        </record>

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

        <record id="crm_tracking_campaign_act" model="ir.actions.act_window">
            <field name="name">Campaigns</field>
            <field name="res_model">crm.tracking.campaign</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="crm_tracking_campaign_tree"/>
        </record>

        <menuitem action="crm_tracking_campaign_act"
            id="menu_crm_tracking_campaign_act" sequence="4"
            groups="base.group_no_one"
            parent="base.menu_crm_config_lead"/>


        <!-- 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="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="arch" type="xml">
                <form string="Partner Segmentation Lines">
                    <group col="4">
                        <field colspan="4" name="name"/>
                        <group col="2" colspan="4">
                            <field name="expr_name"/>
                            <field name="expr_operator"/>
                            <field name="expr_value"/>
                        </group>
                        <field name="operator"/>
                    </group>
                </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="arch" type="xml">
                <form string="Partner Segmentation">
                    <header>
                        <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"/>
                        <field name="state" widget="statusbar"/>
                    </header>
                    <group col="4">
                        <field name="name"/>
                        <field name="categ_id"/>
                        <field name="exclusif"/>
                    </group>
                    <notebook>
                       <page string="Sales Purchase">
                           <group>
                               <field name="sales_purchase_active"/>
                           </group>
                           <separator string="Segmentation Test"/>
                           <field name="segmentation_line" widget="one2many_list"/>
                       </page>
                       <page string="Description">
                           <field name="description"/>
                       </page>
                    </notebook>
                </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="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">Contacts 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" type="html">
              <p class="oe_view_nocontent_create">
                Click to define a new customer segmentation.
              </p><p>
                Create specific categories which you can assign to your
                contacts to better manage your interactions with them. The
                segmentation tool is able to assign categories to contacts
                according to criteria you set.
              </p>
            </field>
        </record>

       <menuitem action="crm_segmentation_tree-act"
            id="menu_crm_segmentation-act"
            groups="base.group_no_one" sequence="15"
            parent="base.menu_base_config"/>

        <!-- Payment Mode Tree View -->

        <record model="ir.ui.view" id="view_crm_payment_mode_tree">
            <field name="name">crm.payment.mode.tree</field>
            <field name="model">crm.payment.mode</field>
            <field name="arch" type="xml">
                <tree string="Payment Mode">
                    <field name="name"/>
                    <field name="section_id" groups="base.group_multi_salesteams"/>
                </tree>
            </field>
        </record>

        <!-- Payment Mode Form View -->

        <record model="ir.ui.view" id="view_crm_payment_mode_form">
            <field name="name">crm.payment.mode.form</field>
            <field name="model">crm.payment.mode</field>
            <field name="arch" type="xml">
                <form string="Payment Mode">
                    <group>
                        <field name="name"/>
                        <field name="section_id" groups="base.group_multi_salesteams"/>
                    </group>
                </form>
            </field>
        </record>

        <!-- Payment Mode Action -->

        <record id="action_crm_payment_mode" model="ir.actions.act_window">
            <field name="name">Payment Mode</field>
            <field name="res_model">crm.payment.mode</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
        </record>

        <menuitem action="action_crm_payment_mode"
            id="menu_crm_payment_mode_act"
            groups="base.group_no_one"
            name="Payment Modes"
            parent="base.menu_crm_config_lead"/>
    </data>
</openerp>
