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

        <record id="view_account_report_form" model="ir.ui.view">
            <field name="name">account.report.report.form</field>
            <field name="model">account.report.report</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Accounting reporting">
                    <notebook>
                        <page string="General">
                            <field colspan="4" name="name" select="1"/>
                            <field name="code" select="1"/>
                            <field name="active" select="1"/>
                            <field name="parent_id" on_change="onchange_parent_id(parent_id)"/>
                            <field name="sequence"/>
                            <field name="type" select="1"/>
                            <newline/>
                            <!-- <field name="color_font"/> #TOCHECK: why need it ?
                            <field name="color_back"/> -->
                            <field name="badness_limit"/>
                            <field name="goodness_limit"/>
                            <field colspan="4" name="expression"/>
                            <field name="disp_tree"/>
                            <field name="disp_graph"/>
                            <separator colspan="4" string="Legend of operators"/>
                            <label align="1.0" string="Account Debit:"/>
                            <label align="0.0" string="debit(['ACCOUNT_CODE',],fiscalyear)"/>
                            <label align="1.0" string="Account Credit:"/>
                            <label align="0.0" string="credit(['ACCOUNT_CODE',],fiscalyear)"/>
                            <label align="1.0" string="Account Balance:"/>
                            <label align="0.0" string="balance(['ACCOUNT_CODE',],fiscalyear)"/>
                            <label align="1.0" string="Account Tax Code:"/>
                            <label align="0.0" string="tax_code(['ACCOUNT_TAX_CODE',],period)"/>
                            <label align="1.0" string="Report Amount:"/>
                            <label align="0.0" string="report('REPORT_CODE')"/>
                            <newline/>
                            <label align="1.0" string="Operators:"/>
                            <label align="0.0" string="+ - * / ( )"/>
                            <label colspan="4" string="Example: (balance(['6','45'],-1) - credit(['7'])) / report('RPT1')"/>
                            <label colspan="4" string="Note: The second argument 'fiscalyear' and 'period' are optional arguments.If the value is -1,previous fiscalyear or period is considered."/>
                            <separator colspan="4" string="Return value for status"/>
                            <group col="2" colspan="2">
                                <label align="1.0" string="&lt; Badness Indicator Limit:"/>
                                <label align="0.0" string="Very bad"/>
                                <newline/>
                                <label align="1.0" string="= Badness Indicator Limit:"/>
                                <label align="0.0" string="Bad"/>
                                <newline/>
                                <label align="1.0" string="= Goodness Indicator Limit:"/>
                                <label align="0.0" string="Good"/>
                                <newline/>
                                <label align="1.0" string="> Goodness Indicator Limit:"/>
                                <label align="0.0" string="Very Good"/>
                                <newline/>
                            </group>
                            <group col="2" colspan="2">
                            </group>
                        </page>
                        <page string="Notes">
                            <field colspan="4" name="note" nolabel="1"/>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>

        <record id="view_account_report_tree_simple" model="ir.ui.view">
            <field name="name">account.report.report.tree.simple</field>
            <field name="model">account.report.report</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Accounting reporting">
                    <field name="code"/>
                    <field name="name"/>
                </tree>
            </field>
        </record>

        <record id="action_account_report_tree" model="ir.actions.act_window">
            <field name="name">Custom reporting</field>
            <field name="res_model">account.report.report</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain"/>
            <field name="view_id" ref="view_account_report_tree_simple"/>
        </record>
        <menuitem
            parent="account.menu_finance_generic_reporting"
            id="menu_menu_finance_generic_reporting"
            name="Reporting"/>

        <menuitem action="action_account_report_tree" id="menu_action_account_report_tree_define" parent="menu_menu_finance_generic_reporting" sequence="20"/>

        <record id="view_account_report_tree" model="ir.ui.view">
            <field name="name">account.report.report.tree</field>
            <field name="model">account.report.report</field>
            <field name="type">tree</field>
            <field eval="8" name="priority"/>
            <field name="field_parent">child_ids</field>
            <field name="arch" type="xml">
                <tree string="Accounting reporting">
                    <field name="code"/>
                    <field name="name"/>
                    <field name="status"/>
                    <field name="amount"/>
                </tree>
            </field>
        </record>

        <record id="action_account_report_tree_view" model="ir.actions.act_window">
            <field name="name">Custom Reporting</field>
            <field name="res_model">account.fiscalyear</field>
            <field name="view_type">tree</field>
            <field name="view_id" ref="view_account_report_tree"/>
            <field name="domain">[('parent_id','=',False)]</field>
        </record>

        <menuitem action="action_account_report_tree_view" id="menu_action_account_report_tree_view" parent="menu_menu_finance_generic_reporting" sequence="5"/>

        <record id="action_account_report_tree_view_fiscal" model="ir.actions.act_window">
            <field name="name">Fiscal Statements reporting</field>
            <field name="res_model">account.fiscalyear</field>
            <field name="view_type">tree</field>
            <field name="view_id" ref="view_account_report_tree"/>
            <field name="domain">[('type','=','fiscal'),('parent_id','=',False)]</field>
        </record>
        <menuitem action="action_account_report_tree_view_fiscal" id="menu_action_account_report_tree_view_fiscal" parent="account_report.menu_action_account_report_tree_view"/>

        <record id="action_account_report_tree_view_indicator" model="ir.actions.act_window">
            <field name="name">Indicators reporting</field>
            <field name="res_model">account.fiscalyear</field>
            <field name="view_type">tree</field>
            <field name="view_id" ref="view_account_report_tree"/>
            <field name="domain">[('type','=','indicator'),('parent_id','=',False)]</field>
        </record>
        <menuitem action="action_account_report_tree_view_indicator" id="menu_action_account_report_tree_view_indicator" parent="account_report.menu_action_account_report_tree_view"/>

        <record id="action_account_report_tree_view_other" model="ir.actions.act_window">
            <field name="name">Other reports</field>
            <field name="res_model">account.fiscalyear</field>
            <field name="view_type">tree</field>
            <field name="view_id" ref="view_account_report_tree"/>
            <field name="domain">[('type','=','other'),('parent_id','=',False)]</field>
        </record>
        <menuitem action="action_account_report_tree_view_other" id="menu_action_account_report_tree_view_other" parent="account_report.menu_action_account_report_tree_view"/>

        <record model="ir.ui.view" id="account_report_history_tree">
            <field name="name">account.report.history1</field>
            <field name="model">account.report.history</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Account Report History">
                    <field name="period_id"/>
                    <field name="fiscalyear_id"/>
                    <field name="name"/>
                    <field name="val"/>
                </tree>
            </field>
        </record>

        <record model="ir.ui.view" id="account_report_history_form">
            <field name="name">account.report.history2</field>
            <field name="model">account.report.history</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Account Report History">
                    <field name="period_id"/>
                    <field name="fiscalyear_id" select="1"/>
                    <field name="name" select="1"/>
                    <field name="val"/>
                </form>
            </field>
        </record>

        <record model="ir.ui.view" id="account_report_history_graph">
            <field name="name">account.report.history3</field>
            <field name="model">account.report.history</field>
            <field name="type">graph</field>
            <field name="arch" type="xml">
                <graph string="Account Report History" type="bar">
                    <field name="period_id"/>
                    <field name="val" operator="+"/>
                    <field name="name" group="True"/>

                </graph>
            </field>
        </record>

        <act_window
            id="account_report_history_record_structure"
            name="Indicator history"
            res_model="account.report.history"
            src_model="account.report.report"
            domain="[('name','=', active_id)]"
            view_type="form"
            view_mode="graph,tree"/>

        <record model="ir.values" id="ir_open_account_history_view">
            <field name="key2">tree_but_open</field>
            <field name="model">account.report.report</field>
            <field name="name">Open account history</field>
            <field name="value" eval="'ir.actions.act_window,%d'%account_report_history_record_structure"/>
            <field name="object" eval="True"/>
        </record>

    </data>
</openerp>
