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

        <record id="view_account_followup_stat_tree" model="ir.ui.view">
            <field name="name">account_followup.stat.tree</field>
            <field name="model">account_followup.stat</field>
            <field name="arch" type="xml">
                <tree string="Follow-up lines" create="false">
                    <field name="partner_id"/>
                    <field name="date_move"/>
                    <field name="date_move_last"/>
                    <field name="date_followup" />
                    <field name="followup_id" />
                    <field name="debit"/>
                    <field name="credit"/>
                    <field name="balance" sum="Balance"/>
                    <field name="company_id" groups="base.group_multi_company"/>
                    <field name="blocked" invisible="1" />
                    <field name="period_id" invisible="1" />
                </tree>
            </field>
        </record>

      <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="bar">
                  <field name="partner_id"/>
                  <field name="balance" operator="+"/>
               </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 icon="terp-go-year" string="This Fiscal year" name="fiscalyear" domain="[('period_id','in','current_year')]"
                        help="Follow-up Entries with period in current year"/>
                    <separator/>
                    <filter icon="terp-camera_test" 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" icon="terp-partner" context="{'group_by':'partner_id'}" />
                        <filter string="Litigation" icon="terp-camera_test"  context="{'group_by':'blocked'}" />
                        <filter string="Follow-up Level" icon="terp-stock_effects-object-colorize" name="followup_level" context="{'group_by':'followup_id'}" />
                        <filter string="Latest Follow-up Date" icon="terp-go-month" context="{'group_by':'date_followup'}" />
                        <filter string="Company" groups="base.group_multi_company" icon="terp-go-home" context="{'group_by':'company_id'}" />
                    </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">tree,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>
