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

        <record id="accounting_report_view" model="ir.ui.view">
            <field name="name">Accounting Report</field>
            <field name="model">accounting.report</field>
            <field name="inherit_id" ref="account.account_common_report_view"/>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='target_move']" position="after">
                    <field name="account_report_id" domain="[('parent_id','=',False)]"/>
                    <field name="enable_filter"/>
                    <field name="debit_credit" attrs="{'invisible': [('enable_filter','=',True)]}"/>
                </xpath>
                <xpath expr="//notebook/page[@string='Filters']" position="after">
                    <page string="Comparison" attrs="{'invisible': [('enable_filter','=',False)]}">
                        <group>
                            <field name="label_filter" attrs="{'required': [('enable_filter', '=', True)]}"/>
                            <field name="fiscalyear_id_cmp"/><newline/>
                            <field name="filter_cmp"/>
                        </group>
                        <group string="Dates" attrs="{'invisible':[('filter_cmp', '!=', 'filter_date')]}">
                            <field name="date_from_cmp" attrs="{'required':[('filter_cmp', '=', 'filter_date')]}"/>
                            <field name="date_to_cmp" attrs="{'required':[('filter_cmp', '=', 'filter_date')]}"/>
                        </group>
                        <group string="Periods" attrs="{'invisible':[('filter_cmp', '!=', 'filter_period')]}">
                            <field name="period_from_cmp" domain="[('fiscalyear_id', '=', fiscalyear_id_cmp)]" attrs="{'required':[('filter_cmp', '=', 'filter_period')]}"/>
                            <field name="period_to_cmp" domain="[('fiscalyear_id', '=', fiscalyear_id_cmp)]" attrs="{'required':[('filter_cmp', '=', 'filter_period')]}"/>
                        </group>
                   </page>
                </xpath>
                <xpath expr="//notebook/page[@string='Journals']" position="replace">
                </xpath>
            </field>
        </record>

        <menuitem parent="account.menu_finance_legal_statement" id="final_accounting_reports" name="Accounting Reports"/>

        <record id="action_account_report_bs" model="ir.actions.act_window">
             <field name="name">Balance Sheet</field>
             <field name="res_model">accounting.report</field>
             <field name="type">ir.actions.act_window</field>
             <field name="view_type">form</field>
             <field name="view_mode">form</field>
             <field name="view_id" ref="accounting_report_view"/>
             <field name="target">new</field>
             <field name="context" eval="{'default_account_report_id':ref('account.account_financial_report_balancesheet0')}"/>
        </record>
        <menuitem icon="STOCK_PRINT" name="Balance Sheet" action="action_account_report_bs" id="menu_account_report_bs" parent="final_accounting_reports"/>

        <record id="action_account_report_pl" model="ir.actions.act_window">
             <field name="name">Profit and Loss</field>
             <field name="res_model">accounting.report</field>
             <field name="type">ir.actions.act_window</field>
             <field name="view_type">form</field>
             <field name="view_mode">form</field>
             <field name="view_id" ref="accounting_report_view"/>
             <field name="target">new</field>
             <field name="context">{}</field>
             <field name="context" eval="{'default_account_report_id':ref('account.account_financial_report_profitandloss0')}"/>
        </record>
        <menuitem icon="STOCK_PRINT" name="Profit And Loss" action="action_account_report_pl" id="menu_account_report_pl" parent="final_accounting_reports"/>

        <record id="action_account_report" model="ir.actions.act_window">
             <field name="name">Financial Reports</field>
             <field name="res_model">accounting.report</field>
             <field name="type">ir.actions.act_window</field>
             <field name="view_type">form</field>
             <field name="view_mode">form</field>
             <field name="view_id" ref="accounting_report_view"/>
             <field name="target">new</field>
        </record>
        <menuitem icon="STOCK_PRINT" name="Financial Report" action="action_account_report" id="menu_account_report" parent="final_accounting_reports" sequence="100"/>

    </data>
</openerp>
