<?xml version="1.0"?>
<openerp>
    <data>
    <record id="view_campaign_analysis_tree" model="ir.ui.view">
        <field name="name">campaign.analysis.tree</field>
        <field name="model">campaign.analysis</field>
        <field name="arch" type="xml">
            <tree string="Marketing Reports" create="false">
                <field name="year" invisible="1"/>
                <field name="month" invisible="1"/>
                <field name="day" invisible="1"/>
                <field name="date" invisible="1"/>
                <field name="state" invisible="1"/>
                <field name="campaign_id" invisible="1"/>
                <field name="activity_id" invisible="1"/>
                <field name="segment_id" invisible="1"/>
                <field name="partner_id" invisible="1"/>
                <field name="country_id" invisible="1"/>
                <field name="res_id" invisible="1"/>
                <field name="count"/>
                <field name="total_cost" string="Cost"/><!-- sum="Cost"/-->
                <field name="revenue"/>
            </tree>
        </field>
    </record>

    <record id="view_campaign_analysis_search" model="ir.ui.view">
        <field name="name">campaign.analysis.search</field>
        <field name="model">campaign.analysis</field>
        <field name="arch" type="xml">
            <search string="Campaign Analysis">
                <field name="date"/>
                <filter icon="terp-gtk-go-back-rtl" string="To Do" domain="[('state','=','todo')]"/>
                <filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]"/>
                <filter icon="terp-emblem-important" string="Exceptions" domain="[('state','=','exception')]"/>
                <field name="campaign_id"/>
                <field name="activity_id"/>
                <field name="segment_id"/>
                <field name="partner_id"/>
                <field name="country_id"/>
                <group expand="0" string="Group By...">
                    <filter string="Campaign" name="Campaign" icon="terp-gtk-jump-to-rtl" context="{'group_by':'campaign_id'}" />
                    <filter string="Segment" name="Segment" icon="terp-stock_symbol-selection" context="{'group_by':'segment_id'}"/>
                    <filter string="Activity" name="activity" icon="terp-stock_align_left_24" context="{'group_by':'activity_id'}"/>
                    <filter string="Resource" icon="terp-accessories-archiver" context="{'group_by':'res_id'}"/>
                    <filter string="Status" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
                    <filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}"/>
                    <filter string="Day" icon="terp-go-today" context="{'group_by':'day'}"/>
                    <filter string="Month" icon="terp-go-month" context="{'group_by':'month'}"/>
                    <filter string="Year" icon="terp-go-year" context="{'group_by':'year'}"/>
                </group>
            </search>
        </field>
    </record>

    <record id="action_campaign_analysis_all" model="ir.actions.act_window">
        <field name="name">Campaign Analysis</field>
        <field name="res_model">campaign.analysis</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree</field>
        <field name="context">{'search_default_year': 1,"search_default_This Month":1,'group_by': [], 'search_default_Campaign': 1, 'search_default_Segment': 1, 'group_by_no_leaf':1}</field>
        <field name="search_view_id" ref="view_campaign_analysis_search"/>
    </record>

    <menuitem name="Marketing" id="base.menu_report_marketing" parent="base.menu_reporting" sequence="45"/>
    <menuitem action="action_campaign_analysis_all" id="menu_action_campaign_analysis_all" parent="base.menu_report_marketing" sequence="2"/>

    </data>
</openerp>
