<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

      <record id="view_account_followup_stat_graph" model="ir.ui.view">
           <field name="name">account_followup.stat.graph</field>
           <field name="model">account_followup.stat</field>
           <field name="arch" type="xml">
               <graph string="Follow-up lines" type="pivot">
                  <field name="followup_id" type="row"/>
                  <field name="date_followup" type="col"/>
                  <field name="balance" type="measure"/>
               </graph>
           </field>
      </record>
        <record id="view_account_followup_stat_search" model="ir.ui.view">
            <field name="name">account_followup.stat.search</field>
            <field name="model">account_followup.stat</field>
            <field name="arch" type="xml">
                <search string="Follow-ups Sent">
                    <field name="date_move"/>
                    <field name="date_move_last"/>
                    <filter string="This Fiscal year" name="fiscalyear" domain="[('period_id','in','current_year')]"
                        help="Follow-up Entries with period in current year"/>
                    <separator/>
                    <filter string="Not Litigation" domain="[('blocked','=', False)]"
                        help = "Including journal entries marked as a litigation"/>
                    <field name="partner_id"/>
                    <field name="balance"/>
                    <group expand="1" string="Group By">
                        <filter string="Partner" context="{'group_by':'partner_id'}" />
                        <filter string="Litigation" context="{'group_by':'blocked'}" />
                        <filter string="Follow-up Level" name="followup_level" context="{'group_by':'followup_id'}" />
                        <filter string="Company" groups="base.group_multi_company" context="{'group_by':'company_id'}" />
                        <separator/>
                        <filter string="Latest Follow-up Month" context="{'group_by':'date_followup:month'}" />
                    </group>
                </search>
            </field>
        </record>
        <record id="action_followup_stat" model="ir.actions.act_window">
            <field name="name">Follow-ups Sent</field>
            <field name="res_model">account_followup.stat</field>
            <field name="view_type">form</field>
            <field name="view_mode">graph</field>
            <field name="context">{'search_default_followup_level':1}</field>
            <field name="search_view_id" ref="view_account_followup_stat_search"/>
        </record>
        <menuitem id="menu_finance_followup" parent="account.menu_finance" name="Payment Follow-up" groups="account.group_account_invoice"/>
        <menuitem action="action_followup_stat" id="menu_action_followup_stat_follow" parent="account.menu_finance_reporting" groups="account.group_account_invoice" name="Follow-Ups Analysis" sequence="10"/>

    </data>
</openerp>
