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

    <record id="view_account_financial_report_form" model="ir.ui.view">
        <field name="name">account.financial.report.form</field>
        <field name="model">account.financial.report</field>
        <field name="arch" type="xml">
            <form string="Account Report">
                <sheet>
                    <group>
                        <group>
                            <field name="name"/>
                            <field name="parent_id"/>
                            <field name="sequence"/>
                        </group>
                        <group>
                            <field name="type"/>
                            <field name="sign"/>
                            <field name="style_overwrite"/>
                        </group>
                    </group>
                    <notebook>
                        <page string="Report"
                              invisible="type not in ['accounts', 'account_type', 'account_report']">
                            <group>
                                <field name="display_detail"
                                       invisible="type not in ['accounts', 'account_type', 'account_report']"/>
                                <field name="account_report_id"
                                       invisible="type != 'account_report'"/>
                            </group>
                            <field name="account_ids" invisible="type != 'accounts'"/>
                            <field name="account_type_ids" invisible="type != 'account_type'"/>
                        </page>
                        <page string="Childrens">
                            <field name="children_ids" nolabel="1">
                            </field>
                        </page>
                    </notebook>
                </sheet>
            </form>
        </field>
    </record>

    <record id="view_account_financial_report_tree" model="ir.ui.view">
        <field name="name">account.financial.report.list</field>
        <field name="model">account.financial.report</field>
        <field name="arch" type="xml">
            <list string="Account Report">
                <field name="name"/>
                <field name="parent_id" invisible="1"/>
                <field name="type"/>
                <field name="account_report_id"/>
            </list>
        </field>
    </record>

    <record id="view_account_financial_report_search" model="ir.ui.view">
        <field name="name">account.financial.report.search</field>
        <field name="model">account.financial.report</field>
        <field name="arch" type="xml">
            <search string="Account Report">
                <field name="name" string="Account Report"/>
                <field name="type"/>
                <field name="account_report_id"/>
                <filter string="Reports" name="filter_parent_id" domain="[('parent_id','=', False)]"/>
                <group expand="0" string="Group By">
                    <filter name="parent_report" string="Parent Report" domain=""
                            context="{'group_by':'parent_id'}"/>
                    <filter name="report_type" string="Report Type" domain="[]" context="{'group_by':'type'}"/>
                </group>
            </search>
        </field>
    </record>

    <record id="action_account_financial_report_tree" model="ir.actions.act_window">
        <field name="name">Financial Reports</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">account.financial.report</field>
        <field name="view_mode">list,form</field>
        <field name="context">{'search_default_filter_parent_id': True}</field>
        <field name="search_view_id" ref="view_account_financial_report_search"/>
        <field name="view_id" ref="view_account_financial_report_tree"/>
    </record>

    <menuitem id="menu_finance_reports_settings"
              name="Financial Reports"
              sequence="9"
              groups="account.group_account_user,account.group_account_manager"
              parent="account.menu_finance_configuration"/>

    <menuitem id="menu_account_reports"
              name="Account Reports"
              action="action_account_financial_report_tree"
              groups="account.group_account_user,account.group_account_manager"
              parent="menu_finance_reports_settings"/>

</odoo>

