<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <!-- Analytic accounts to close -->
        <record id="view_analytic_account_close_form" model="ir.ui.view">
            <field name="name">report.analytic.account.close.form</field>
            <field name="model">report.analytic.account.close</field>
            <field name="arch" type="xml">
                <form string="Expired analytic accounts">
                    <field name="name" groups="analytic.group_analytic_accounting"/>
                    <field name="partner_id"/>
                    <field name="quantity"/>
                    <field name="state"/>
                    <field name="quantity_max"/>
                    <field name="date_deadline"/>
                    <field name="balance"/>
                </form>
            </field>
        </record>


        <record id="view_analytic_account_close_tree" model="ir.ui.view">
            <field name="name">report.analytic.account.close.tree</field>
            <field name="model">report.analytic.account.close</field>
            <field name="arch" type="xml">
                <tree string="Expired analytic accounts">
                    <field name="name" groups="analytic.group_analytic_accounting"/>
                    <field name="partner_id"/>
                    <field name="state"/>
                    <field name="quantity"/>
                    <field name="quantity_max"/>
                    <field name="date_deadline"/>
                    <field name="balance"/>
                </tree>
            </field>
        </record>

        <record id="view_analytic_account_graph" model="ir.ui.view">
            <field name="name">report.analytic.account.close.graph</field>
            <field name="model">report.analytic.account.close</field>
            <field name="arch" type="xml">
                <graph string="Expired analytic accounts" type="bar">
                    <field name="partner_id"/>
                    <field name="quantity" operator="+"/>
                    <field name="quantity_max" operator="+"/>
                </graph>
            </field>
        </record>

        <record id="action_analytic_account_tree" model="ir.actions.act_window">
            <field name="name">Expired analytic accounts</field>
            <field name="res_model">report.analytic.account.close</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,graph</field>
            <field name="domain">[('state','=','open')]</field>
        </record>

        <record id="account_analytic_line_to_invoice_view_form" model="ir.ui.view">
            <field name="name">report.account.analytic.line.to.invoice</field>
            <field name="model">report.account.analytic.line.to.invoice</field>
            <field name="arch" type="xml">
                <form string="Analytic Lines to Invoice">
                    <field name="name"/>
                    <field name="month"/>
                    <field name="account_id" groups="analytic.group_analytic_accounting"/>
                    <newline/>
                    <field name="product_id"/>
                    <field name="product_uom_id"/>
                    <newline/>
                    <field colspan="1" name="amount"/>
                    <field colspan="1" name="unit_amount"/>
                </form>
            </field>
        </record>

        <record id="account_analytic_line_to_invoice_view_tree" model="ir.ui.view">
            <field name="name">report.account.analytic.line.to.invoice</field>
            <field name="model">report.account.analytic.line.to.invoice</field>
            <field name="arch" type="xml">
                <tree string="Analytic Lines to Invoice">
                    <field name="name"/>
                    <field name="month"/>
                    <field name="product_id"/>
                    <field name="account_id" groups="analytic.group_analytic_accounting"/>
                    <field name="amount"/>
                    <field name="sale_price"/>
                    <field name="unit_amount"/>
                    <field name="product_uom_id"/>
                </tree>
            </field>
        </record>

        <record id="account_analytic_line_to_invoice_view_graph" model="ir.ui.view">
            <field name="name">report.account.analytic.line.to.invoice.graph</field>
            <field name="model">report.account.analytic.line.to.invoice</field>
            <field name="arch" type="xml">
                <graph string="Analytic Lines to Invoice" type="bar">
                    <field name="name"/>
                    <field name="sale_price" operator="+"/>
                </graph>
            </field>
        </record>

        <record id="account_analytic_line_to_invoice_view_filter" model="ir.ui.view">
            <field name="name">report.account.analytic.line.to.invoice.select</field>
            <field name="model">report.account.analytic.line.to.invoice</field>
            <field name="arch" type="xml">
                <search string="Analytic Lines to Invoice">
                    <field name="name" string="Analytic Lines"/>
                    <field name="month"/>
                    <field name="product_id"/>
                    <field name="account_id" groups="analytic.group_analytic_accounting"/>
               </search>
            </field>
        </record>

        <record id="action_account_analytic_line_to_invoice" model="ir.actions.act_window">
            <field name="name">Analytic Lines to Invoice</field>
            <field name="res_model">report.account.analytic.line.to.invoice</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,graph</field>
            <field name="search_view_id" ref="account_analytic_line_to_invoice_view_filter"/>
        </record>

        <record id="act_acc_analytic_acc_2_report_acc_analytic_line_to_invoice" model="ir.actions.act_window">
            <field name="domain">[]</field>
            <field name="context">{'search_default_account_id': [active_id], 'default_account_id': active_id,'search_default_to_invoice': 1}</field>
            <field name="name">To Invoice</field>
            <field name="res_model">account.analytic.line</field>
            <field name="src_model">account.analytic.account</field>
        </record>

    </data>
</openerp>
