<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data> 
   
   <record id="view_sale_receipt_report_tree" model="ir.ui.view">
        <field name="name">sale.receipt.report.tree</field>
        <field name="model">sale.receipt.report</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree colors="blue:state in ('draft');gray:state in ('cancel','paid');black:state in ('proforma','proforma2')"  string="Sales Receipt Analysis">
                <field name="date" invisible="1"/>
                <field name="user_id" invisible="1"/>
                <field name="year" invisible="1"/>
                <field name="day" invisible="1"/>
                <field name="month" invisible="1"/>
                <field name="type" invisible="1"/>
                <field name="company_id" invisible="1"/>
                <field name="partner_id" invisible="1"/>
                <field name="state" invisible="1"/>
                <field name="currency_id" invisible="1"/>
                <field name="journal_id" invisible="1"/>
                <field name="date_due" invisible="1"/>
                <field name="account_id" invisible="1"/>
                <field name="nbr" sum="# of Voucher Lines"/>
                <field name="price_total" sum="Total Without Tax"/>
                <field name="price_total_tax" sum="Total With Tax"/>
                <field name="due_delay"  sum="Avg. Due Delay"/>
                <field name="delay_to_pay"  sum="Avg. Delay To Pay"/>
            </tree>
        </field>
    </record>

    <record id="view_sale_receipt_report_graph" model="ir.ui.view">
         <field name="name">sale.receipt.report.graph</field>
         <field name="model">sale.receipt.report</field>
         <field name="type">graph</field>
         <field name="arch" type="xml">
             <graph string="Sales Receipt Analysis" type="bar">
                 <field name="account_id"/>
                 <field name="price_total"/>
             </graph>
         </field>
    </record>

    <record id="view_sale_receipt_report_search" model="ir.ui.view">
        <field name="name">sale.receipt.report.search</field>
        <field name="model">sale.receipt.report</field>
        <field name="type">search</field>
        <field name="arch" type="xml">
            <search string="Sales Receipt Analysis">
              <group col="10" colspan="12">
                    <filter string="Draft"
                           icon="terp-document-new"
                           domain="[('state','=','draft')]"
                           help = "Draft Vouchers"/>
                    <filter string="Pro-forma"
                           icon="terp-gtk-media-pause"
                           domain="[('state','=','proforma')]"
                           help = "Pro-forma Vouchers"/>
                    <filter string="Posted"
                           name="current"
                           icon="terp-check"
                           domain="[('state','not in', ('draft','cancel'))]"
                           help = "Validated Vouchers"/>
                   <separator orientation="vertical"/>
                   <field name="partner_id"/>
                   <field name="date" string="Voucher Date"/>
                </group>
                <newline/>
                <group expand="0" string="Extended Filters..." groups="base.group_extended">
                    <field name="journal_id" widget="selection"/>
                    <field name="pay_now"/>
                    <field name="account_id"/>
                    <separator orientation="vertical"/>
                    <field name="date_due"/>
                    <separator orientation="vertical" groups="base.group_multi_company"/>
                    <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                </group>
                <newline/>
                <group expand="1" string="Group By...">
                    <filter string="Partner" name="partner" icon="terp-partner" context="{'group_by':'partner_id'}"/>
                    <filter string="Salesman" name='user' icon="terp-personal" context="{'group_by':'user_id'}"/>
                    <separator orientation="vertical"/>
                    <filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
                    <filter string="Type" icon="terp-stock_symbol-selection" context="{'group_by':'type'}"/>
                    <separator orientation="vertical"/>
                    <filter string="Journal" icon="terp-folder-orange" context="{'group_by':'journal_id'}"/>
                    <separator orientation="vertical"/>
                    <filter string="Due Date" icon="terp-go-today" context="{'group_by':'date_due'}"/>
                    <separator orientation="vertical" groups="base.group_multi_company"/>
                    <filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
                    <separator orientation="vertical"/>
                    <filter string="Day" name="day" icon="terp-go-today" context="{'group_by':'day'}" help="Group by Invoice Date"/>
                    <filter string="Month" name="month" icon="terp-go-month" context="{'group_by':'month'}" help="Group by month of Invoice Date"/>
                    <filter string="Year" name="year" icon="terp-go-year" context="{'group_by':'year'}" help="Group by year of Invoice Date"/>
                </group>
            </search>
        </field>
    </record>

    <record id="action_sale_receipt_report_all" model="ir.actions.act_window">
        <field name="name">Sales Receipt Analysis</field>
        <field name="res_model">sale.receipt.report</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,graph</field>
        <field name="context">{'search_default_current':1, 'search_default_partner':1, 'search_default_customer':1, 'search_default_date': time.strftime('%Y-01-01'), 'group_by':[], 'group_by_no_leaf':1,}</field>
        <field name="search_view_id" ref="view_sale_receipt_report_search"/>
        <field name="help">From this report, you can have an overview of the amount invoiced to your customer as well as payment delays. The tool search can also be used to personalise your Invoices reports and so, match this analysis to your needs.</field>

    </record>

    <menuitem action="action_sale_receipt_report_all" id="menu_action_sale_receipt_report_all" parent="account.menu_finance_statistic_report_statement" sequence="3"/>
       
   </data>
</openerp>