<?xml version="1.0"?>
<openerp>
    <data noupdate="1">

        <!-- Crm stages -->
        <record model="crm.case.stage" id="stage_lead1">
            <field name="name">New</field>
            <field eval="1" name="case_default"/>
            <field name="state">draft</field>
            <field eval="0" name="probability"/>
            <field eval="10" name="sequence"/>
            <field name="type">both</field>
        </record>
        <record model="crm.case.stage" id="stage_lead2">
            <field name="name">Opportunity</field>
            <field eval="1" name="case_default"/>
            <field name="state">open</field>
            <field eval="20" name="probability"/>
            <field eval="20" name="sequence"/>
            <field name="type">lead</field>
        </record>
        <record model="crm.case.stage" id="stage_lead7">
            <field name="name">Dead</field>
            <field eval="1" name="case_default"/>
            <field eval="False" name="fold"/>
            <field name="state">cancel</field>
            <field eval="0" name="probability"/>
            <field eval="30" name="sequence"/>
            <field name="type">lead</field>
        </record>
        <record model="crm.case.stage" id="stage_lead3">
            <field name="name">Qualification</field>
            <field eval="1" name="case_default"/>
            <field name="state">open</field>
            <field eval="20" name="probability"/>
            <field eval="100" name="sequence"/>
            <field name="type">opportunity</field>
        </record>
        <record model="crm.case.stage" id="stage_lead4">
            <field name="name">Proposition</field>
            <field eval="1" name="case_default"/>
            <field name="state">open</field>
            <field eval="40" name="probability"/>
            <field eval="110" name="sequence"/>
            <field name="type">opportunity</field>
        </record>
        <record model="crm.case.stage" id="stage_lead5">
            <field name="name">Negotiation</field>
            <field eval="1" name="case_default"/>
            <field name="state">open</field>
            <field eval="60" name="probability"/>
            <field eval="120" name="sequence"/>
            <field name="type">opportunity</field>
        </record>
        <record model="crm.case.stage" id="stage_lead6">
            <field name="name">Won</field>
            <field eval="1" name="case_default"/>
            <field name="state">done</field>
            <field eval="100" name="probability"/>
            <field eval="130" name="sequence"/>
            <field eval="1" name="on_change"/>
            <field name="type">opportunity</field>
        </record>
        <record model="crm.case.stage" id="stage_lead8">
            <field name="name">Lost</field>
            <field eval="1" name="case_default"/>
            <field eval="True" name="fold"/>
            <field eval="1" name="on_change"/>
            <field name="state">cancel</field>
            <field eval="0" name="probability"/>
            <field eval="140" name="sequence"/>
            <field name="type">opportunity</field>
        </record>
        
        <record model="crm.case.section" id="section_sales_department">
            <field name="stage_ids" eval="[ (4, ref('stage_lead1')), (4, ref('stage_lead2')),
                                            (4, ref('stage_lead3')), (4, ref('stage_lead4')),
                                            (4, ref('stage_lead5')), (4, ref('stage_lead6')),
                                            (4, ref('stage_lead7')), (4, ref('stage_lead8'))]"/>
        </record>

        <!-- Crm campain -->
        <record model="crm.case.resource.type" id="type_lead1">
            <field name="name">Telesales</field>
            <field name="section_id" ref="section_sales_department"/>
        </record>
        <record model="crm.case.resource.type" id="type_lead2">
            <field name="name">Email Campaign - Services</field>
            <field name="section_id" ref="section_sales_department"/>
        </record>
        <record model="crm.case.resource.type" id="type_lead3">
            <field name="name">Email Campaign - Products</field>
            <field name="section_id" ref="section_sales_department"/>
        </record>
        <record model="crm.case.resource.type" id="type_lead4">
            <field name="name">Twitter Ads</field>
            <field name="section_id" ref="section_sales_department"/>
        </record>
        <record model="crm.case.resource.type" id="type_lead5">
            <field name="name">Google Adwords</field>
            <field name="section_id" ref="section_sales_department"/>
        </record>
        <record model="crm.case.resource.type" id="type_lead6">
            <field name="name">Banner Ads</field>
            <field name="section_id" ref="section_sales_department"/>
        </record>
        <record model="crm.case.resource.type" id="type_lead7">
            <field name="name">Television</field>
            <field name="section_id" ref="section_sales_department"/>
        </record>
        <record model="crm.case.resource.type" id="type_lead8">
            <field name="name">Newsletter</field>
            <field name="section_id" ref="section_sales_department"/>
        </record>

        <!--  crm categories -->
        <record model="crm.case.categ" id="categ_oppor1">
            <field name="name">Product</field>
            <field name="section_id" ref="section_sales_department"/>
            <field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
        </record>
        <record model="crm.case.categ" id="categ_oppor2">
            <field name="name">Software</field>
            <field name="section_id" ref="section_sales_department"/>
            <field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
        </record>
        <record model="crm.case.categ" id="categ_oppor3">
            <field name="name">Services</field>
            <field name="section_id" ref="section_sales_department"/>
            <field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
        </record>
        <record model="crm.case.categ" id="categ_oppor4">
            <field name="name">Information</field>
            <field name="section_id" ref="section_sales_department"/>
            <field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
        </record>
        <record model="crm.case.categ" id="categ_oppor5">
            <field name="name">Design</field>
            <field name="section_id" ref="section_sales_department"/>
            <field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
        </record>
        <record model="crm.case.categ" id="categ_oppor6">
            <field name="name">Training</field>
            <field name="section_id" ref="section_sales_department"/>
            <field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
        </record>
        <record model="crm.case.categ" id="categ_oppor7">
            <field name="name">Consulting</field>
            <field name="section_id" ref="section_sales_department"/>
            <field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
        </record>
        <record model="crm.case.categ" id="categ_oppor8">
            <field name="name">Other</field>
            <field name="section_id" ref="section_sales_department"/>
            <field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
        </record>

        <!-- CRM-related subtypes for messaging / Chatter -->
        <record id="mt_lead_create" model="mail.message.subtype">
            <field name="name">Lead Created</field>
            <field name="res_model">crm.lead</field>
            <field name="default" eval="False"/>
            <field name="description">Opportunity created</field>
        </record>
        <record id="mt_lead_convert_to_opportunity" model="mail.message.subtype">
            <field name="name">Lead to Opportunity</field>
            <field name="res_model">crm.lead</field>
            <field name="default" eval="False"/>
            <field name="description">Lead converted into an opportunity</field>
        </record>
        <record id="mt_lead_stage" model="mail.message.subtype">
            <field name="name">Stage Changed</field>
            <field name="res_model">crm.lead</field>
            <field name="default" eval="False"/>
            <field name="description">Stage changed</field>
        </record>
        <record id="mt_lead_won" model="mail.message.subtype">
            <field name="name">Opportunity Won</field>
            <field name="res_model">crm.lead</field>
            <field name="default" eval="False"/>
            <field name="description">Opportunity won</field>
        </record>
        <record id="mt_lead_lost" model="mail.message.subtype">
            <field name="name">Opportunity Lost</field>
            <field name="res_model">crm.lead</field>
            <field name="default" eval="False"/>
            <field name="description">Opportunity lost</field>
        </record>
        <!-- Salesteam-related subtypes for messaging / Chatter -->
        <record id="mt_salesteam_lead" model="mail.message.subtype">
            <field name="name">Lead Created</field>
            <field name="res_model">crm.case.section</field>
            <field name="default" eval="False"/>
            <field name="parent_id" eval="ref('mt_lead_create')"/>
            <field name="relation_field">section_id</field>
        </record>
        <record id="mt_salesteam_lead_opportunity" model="mail.message.subtype">
            <field name="name">Lead to Opportunity</field>
            <field name="default" eval="False"/>
            <field name="res_model">crm.case.section</field>
            <field name="parent_id" eval="ref('mt_lead_convert_to_opportunity')"/>
            <field name="relation_field">section_id</field>
        </record>
        <record id="mt_salesteam_lead_stage" model="mail.message.subtype">
            <field name="name">Opportunity Stage Changed</field>
            <field name="res_model">crm.case.section</field>
            <field name="parent_id" eval="ref('mt_lead_stage')"/>
            <field name="relation_field">section_id</field>
        </record>
        <record id="mt_salesteam_lead_won" model="mail.message.subtype">
            <field name="name">Opportunity Won</field>
            <field name="res_model">crm.case.section</field>
            <field name="parent_id" eval="ref('mt_lead_won')"/>
            <field name="relation_field">section_id</field>
        </record>
        <record id="mt_salesteam_lead_lost" model="mail.message.subtype">
            <field name="name">Opportunity Lost</field>
            <field name="res_model">crm.case.section</field>
            <field name="default" eval="False"/>
            <field name="parent_id" eval="ref('mt_lead_lost')"/>
            <field name="relation_field">section_id</field>
        </record>

    </data>
</openerp>
