<?xml version="1.0"?>
<openerp>
    <data>
        <!-- REPORTING/MEMBERSHIP BY YEAR  -->


        <record model="ir.ui.view" id="view_report_membership_tree1">
            <field name="name">report.membership.tree</field>
            <field name="model">report.membership</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree colors="blue:state in ('draft');black:state in ('open','free');gray:state in ('done','cancel') " string="Membership">
                    <field name="state"/>
                    <field name="partner_id"/>
                    <field name="membership_id"/>
                    <field name="canceled_number"/>
                    <field name="waiting_number"/>
                    <field name="invoiced_number"/>
                    <field name="paid_number"/>
                    <field name="year"/>
                    <field name="month"/>
                </tree>
            </field>
        </record>

        <record model="ir.ui.view" id="view_report_membership_search">
            <field name="name">report.membership.search</field>
            <field name="model">report.membership</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Membership">
                    <group col="8" colspan="4">
                        <filter string="Last 365 Days" icon="terp-go-year"
                            domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"/>
                        <filter string="Last 30 Days" icon="terp-go-month" name="month"
                            domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"/>
                        <separator orientation="vertical"/>
		                <filter icon="terp-camera_test"
		                    string="Invoiced"
		                    domain="[('state','=','open')]"/>
		                <filter icon="terp-check"
                            string="Paid"
                            domain="[('state','=','paid')]"/>
                        <filter icon="terp-gtk-media-pause"
                            string="Waiting"
                            default="1" name="none"
                            domain="[('state','=', 'draft')]"/>
    
                        <separator orientation="vertical"/>
                        <field name="partner_id"/>
                        <field name="membership_id"/>
                    </group>
                    <newline/>
                    <group expand="0" string="Group By..." colspan="4" col="12">
                        <filter string="Members" icon="terp-personal" name="member"
                            domain="[]" context="{'group_by':'partner_id'}"/>
                        <filter string="Memberships" icon="terp-personal" name="membership"
                            domain="[]" context="{'group_by':'membership_id'}"/>    
                       <filter string="state" icon="terp-stock_effects-object-colorize"
                            domain="[]" context="{'group_by':'state'}"/>
                                      
                        <separator orientation="vertical"/>       
                        <filter string="Year" name="year" icon="terp-go-year"
                            domain="[]" context="{'group_by':'year'}"/>
                        <filter string="Month" name="month" icon="terp-go-month"
                            domain="[]" context="{'group_by':'month'}"/>    

                    </group>
                </search>
            </field>
        </record>
        
        <record model="ir.ui.view" id="view_report_membership_graph1">
            <field name="name">report.membership.graph1</field>
            <field name="model">report.membership</field>
            <field name="type">graph</field>
            <field name="arch" type="xml">
                <graph string="Membership" type="bar">
                    <field name="year"/>
                    <field name="canceled_number"/>
                    <field name="waiting_number"/>
                    <field name="invoiced_number"/>
                    <field name="paid_number"/>
                </graph>
            </field>
        </record>

        <record model="ir.actions.act_window" id="action_report_membership_tree">
            <field name="res_model">report.membership</field>
            <field name="view_type">form</field>
            <field name="search_view_id" ref="view_report_membership_search"/>
            <field name="context">{"search_default_member":1}</field>
        </record>

        <record model="ir.actions.act_window.view" id="action_report_membership_tree_view1">
            <field name="sequence" eval="1"/>
            <field name="view_mode">tree</field>
            <field name="view_id" ref="view_report_membership_tree1"/>
            <field name="act_window_id" ref="action_report_membership_tree"/>
        </record>


        <record model="ir.actions.act_window.view" id="action_report_membership_tree_view2">
            <field name="sequence" eval="3"/>
            <field name="view_mode">graph</field>
            <field name="view_id" ref="view_report_membership_graph1"/>
            <field name="act_window_id" ref="action_report_membership_tree"/>
        </record>

        <menuitem name="Membership" parent="base.menu_report_association"
            action="action_report_membership_tree"
            id="menu_report_membership"/>

    </data>
</openerp>            
