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

        <!-- Merge Opportunities  -->
        <record model="ir.ui.view" id="merge_opportunity_form">
            <field name="name">crm.merge.opportunity.form</field>
            <field name="model">crm.merge.opportunity</field>
            <field name="arch" type="xml">
                <form string="Merge Leads/Opportunities">
                    <group string="Assign opportunities to">
                        <field name="user_id" class="oe_inline" on_change="on_change_user(user_id, section_id, context)"/>
                        <field name="section_id" class="oe_inline" groups="base.group_multi_salesteams"/>
                    </group>
                    <group string="Select Leads/Opportunities">
                        <field name="opportunity_ids" nolabel="1">
                            <tree>
                                <field name="create_date"/>
                                <field name="name"/>
                                <field name="type"/>
                                <field name="contact_name"/>
                                <field name="email_from"/>
                                <field name="phone"/>
                                <field name="stage_id"/>
                                <field name="user_id"/>
                                <field name="section_id" groups="base.group_multi_salesteams"/>
                            </tree>
                        </field>
                    </group>
                    <footer>
                        <button name="action_merge" type="object" string="Merge" class="oe_highlight"/>
                        or
                        <button string="Cancel" class="oe_link" special="cancel"/>
                    </footer>
                </form>
            </field>
        </record>

        <!--  Merge leads/opportunities action -->
        <record model="ir.actions.act_window" id="merge_opportunity_act">
            <field name="name">Merge leads/opportunities</field>
            <field name="res_model">crm.merge.opportunity</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="view_id" ref="merge_opportunity_form"/>
            <field name="target">new</field>
        </record>

        <act_window id="action_merge_opportunities"
            multi="True"
            key2="client_action_multi" name="Merge leads/opportunities"
            res_model="crm.merge.opportunity" src_model="crm.lead"
            view_mode="form" target="new" view_type="form"
            groups="base.group_sale_salesman"
            />

    </data>
</openerp>
