<?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"/>

        <menuitem id="base.next_id_64" name="Sales"
            parent="base.menu_reporting" sequence="1"/>

        <!-- 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="arch" type="xml">
                <tree string="Channels">
                    <field name="name"/>
                    <field name="active"/>
                </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="arch" type="xml">
                <form string="Channel" version="7.0">
                    <group>
                        <field name="name"/>
                        <field name="active"/>
                    </group>
                </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" type="html">
              <p class="oe_view_nocontent_create">
                Click to define a new channel.
              </p><p>
                Use channels to track the soure 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, etc.
              </p>
            </field>
        </record>

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

        <!-- 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="arch" type="xml">
                <form string="Sales Team" version="7.0">
                    <group>
                        <group>
                            <field name="name" colspan="2"/>
                            <field name="parent_id"/>
                            <field name="code"/>
                        </group>

                        <group>
                            <field name="user_id"/>
                            <field name="resource_calendar_id"/>
                            <field name="active"/>
                        </group>
                    </group>
                    <notebook colspan="4">
                        <page string="Sales Team">
                           <group>
                                <field name="alias_id" invisible="1" required="0"/>
                                <label for="alias_name" attrs="{'invisible': [('alias_domain', '=', False)]}"/>
                                <div attrs="{'invisible': [('alias_domain', '=', False)]}">
                                    <field name="alias_name" class="oe_inline" attrs="{'required': [('alias_id', '!=', False)]}"/>@<field name="alias_domain" class="oe_inline"/>
                                 </div>
                                <field name="change_responsible"/>
                            </group>
                            <separator string="Team Members"/>
                            <field name="member_ids" widget="many2many_kanban">
                                <kanban quick_create="false" create="true">
                                    <field name="name"/>
                                    <templates>
                                        <t t-name="kanban-box">
                                            <div style="position: relative">
                                                <a t-if="! read_only_mode" type="delete" style="position: absolute; right: 0; padding: 4px; diplay: inline-block">X</a>
                                                <div class="oe_module_vignette">
                                                    <div class="oe_module_desc">
                                                        <field name="name"/>
                                                    </div>
                                                </div>
                                            </div>
                                        </t>
                                    </templates>
                                </kanban>
                            </field>
                        </page>
                        <page string="Stages">
                            <separator string="Select Stages for this Sales Team"/>
                            <field name="stage_ids"/>
                        </page>
                        <page string="Notes">
                            <field name="note"/>
                        </page>
                    </notebook>
                    <div class="oe_chatter">
                        <field name="message_follower_ids" widget="mail_followers" help="Follow this salesteam to automatically track the events associated to users of this team."/>
                        <field name="message_ids" widget="mail_thread"/>
                    </div>
                </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="field_parent">child_ids</field>
            <field name="arch" type="xml">
                <tree string="Sales Team">
                    <field name="name"/>
                    <field name="code"/>
                    <field name="user_id"/>
                </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" type="html">
              <p class="oe_view_nocontent_create">
                Click to define a new sales team.
              </p><p>
                Use sales team to organize your different salespersons or
                departments into separate teams. Each team will work in
                its own list of opportunities.
              </p>
            </field>
        </record>

        <menuitem action="crm_case_section_act"
            id="menu_crm_case_section_act" sequence="15"
            parent="base.menu_base_config" groups="base.group_sale_manager"/>


        <!-- 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="state"/>
                    <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" version="7.0">
                    <group col="4">
                        <field name="name"/>
                        <field name="state"/>
                        <field name="probability"/>
                        <field name="type"/>
                        <field name="on_change"/>
                        <field name="sequence"/>
                        <field name="case_default"/>
                        <field name="fold"/>
                    </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" version="7.0">
                    <group>
                        <field name="name"/>
                        <field name="section_id"/>
                        <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"/>
                </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="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="arch" type="xml">
                <form string="Campaign" version="7.0">
                    <group>
                        <field name="name"/>
                        <field name="section_id"/>
                    </group>
                </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_no_one"
            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="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" version="7.0">
                    <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" version="7.0">
                    <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"/>

        <!-- 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"/>

        <!-- 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"/>
                </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" version="7.0">
                    <group>
                        <field name="name"/>
                        <field name="section_id"/>
                    </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>
