<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record id="view_report_vote_tree" model="ir.ui.view">
            <field name="name">report.vote.tree</field>
            <field name="model">report.vote</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Idea Vote Analysis">
                    <field name="date" invisible="1"/>
                    <field name="year" invisible="1"/>
                    <field name="day" invisible="1"/>
                    <field name="month" invisible="1"/>
                    <field name="user_id" invisible="1"/>
                    <field name="idea_id" invisible="1"/>
                    <field name="idea_state"/>
                    <field name="creater_id" invisible="1"/>
                    <field name="category_id" invisible="1"/>
                    <field name="nbr" sum="# of Lines"/>
                    <field name="score" avg="Score"/>
                </tree>
            </field>
        </record>

        <record id="view_report_vote_search" model="ir.ui.view">
            <field name="name">report.vote.search</field>
            <field name="model">report.vote</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Idea Vote Analysis">
                    <group>
                        <filter icon="terp-go-year" string="  Year  "
                            domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;=',time.strftime('%%Y-01-01'))]"
                            help="Idea Vote created in curren year"/>
                        <filter icon="terp-go-month" string="   Month   "
                            domain="[('date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
                            help="Idea Vote created in current month"/>
                        <filter icon="terp-go-month"
                             string="    Month-1    "
                             separator="1"
                             domain="[('date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
                             help="Idea Vote created last month"/>
                         <separator orientation="vertical"/>
                         <filter icon="terp-go-today"
                             string="    Today    "
                             name="today"
                             separator="1"
                             domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d'))]"
                             help="Idea Vote created by today"/>
                        <separator orientation="vertical"/>
                        <filter icon="terp-camera_test"
                            string="Open"
                            domain="[('idea_state','=',('open'))]"/>
                        <separator orientation="vertical"/>
                        <filter icon="terp-camera_test"
                            string="Accepted"
                            domain="[('idea_state','=',('close'))]"/>
                        <filter icon="terp-gtk-stop"
                            string="Refused"
                            domain="[('idea_state','=',('cancel'))]"/>
                        <separator orientation="vertical"/>
                        <field name="idea_id" string="Idea"/>
                        <field name="creater_id" string="Creator"/>
                        <field name="user_id"/>
                    </group>
                    <newline/>
                    <group expand="1" string="Group By..." colspan="10" col="12">
                        <filter string="Creator" icon="terp-personal" context="{'group_by':'creater_id'}"/>
                        <filter string="User" icon="terp-personal" name="User" context="{'group_by':'user_id'}"/>
                        <separator orientation="vertical"/>
                        <filter string="Idea" icon="terp-idea" context="{'group_by':'idea_id'}"/>
                        <separator orientation="vertical"/>
                        <filter string="Category" icon="terp-stock_symbol-selection" context="{'group_by':'category_id'}"/>
                        <separator orientation="vertical"/>
                        <filter string="State" icon="terp-stock_effects-object-colorize" name="State" context="{'group_by':'idea_state'}"/>
                        <separator orientation="vertical"/>
                        <filter string="Day" icon="terp-go-today" context="{'group_by':'day'}" help="Open Date"/>
                        <filter string="Month" icon="terp-go-month" context="{'group_by':'month'}" help="Open Date"/>
                        <filter string="Year" icon="terp-go-year" context="{'group_by':'year'}" help="Open Date"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="action_report_vote_all" model="ir.actions.act_window">
            <field name="name">Ideas Analysis</field>
            <field name="res_model">report.vote</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="search_view_id" ref="view_report_vote_search"/>
            <field name="context">{'search_default_User':1,'search_default_State':1,'group_by_no_leaf':1,'group_by':[]}</field>
        </record>

        <menuitem action="action_report_vote_all" id="menu_report_vote_all" parent="menu_idea_reporting" sequence="1" groups="base.group_tool_manager"/>
    </data>
</openerp>

