<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record id="view_account_analytic_default_tree" model="ir.ui.view">
            <field name="name">account.analytic.default.tree</field>
            <field name="model">account.analytic.default</field>
            <field name="arch" type="xml">
                <tree string="Analytic Defaults">
                    <field name="sequence"/>
                    <field name="analytic_id" required="0" groups="analytic.group_analytic_accounting"/>
                    <field name="product_id"/>
                    <field name="partner_id"/>
                    <field name="user_id"/>
                    <field name="date_start"/>
                    <field name="date_stop"/>
                    <field name="company_id" groups="base.group_multi_company"/>
                </tree>
            </field>
        </record>

        <record id="view_account_analytic_default_form" model="ir.ui.view">
            <field name="name">account.analytic.default.form</field>
            <field name="model">account.analytic.default</field>
            <field name="arch" type="xml">
                <form string="Analytic Defaults" version="7.0">
                    <group col="4">
                        <field name="analytic_id" required="1" groups="analytic.group_analytic_accounting"/>
                        <field name="sequence"/>
                        <separator string="Conditions" colspan="4"/>
                        <field name="product_id"/>
                        <field name="partner_id"/>
                        <field name="user_id"/>
                        <field name="company_id" widget="selection" groups="base.group_multi_company"/>
                        <field name="date_start"/>
                        <field name="date_stop"/>
                    </group>
                </form>
            </field>
        </record>

        <record id="view_account_analytic_default_form_search" model="ir.ui.view">
            <field name="name">account.analytic.default.search</field>
            <field name="model">account.analytic.default</field>
            <field name="arch" type="xml">
                <search string="Accounts">
                    <field name="date_stop"/>
                    <field name="analytic_id" groups="analytic.group_analytic_accounting"/>
                    <field name="product_id"/>
                    <field name="partner_id"/>
                    <field name="user_id"/>
                    <field name="company_id" groups="base.group_multi_company"/>
                    <group expand="0" string="Group By...">
                        <filter string="User" icon="terp-personal" context="{'group_by':'user_id'}" help="User"/>
                        <filter string="Partner" icon="terp-partner"  context="{'group_by':'partner_id'}" help="Partner"/>
                        <filter string="Product" icon="terp-accessories-archiver"  context="{'group_by':'product_id'}" help="Product" />
                        <filter string="Analytic Account" icon="terp-folder-green"  context="{'group_by':'analytic_id'}" help="Analytic Account" groups="analytic.group_analytic_accounting"/>
                        <filter string="Company" icon="terp-go-home"  context="{'group_by':'company_id'}" groups="base.group_multi_company" />
                    </group>
                </search>
            </field>
        </record>

        <record id="action_analytic_default_list" model="ir.actions.act_window">
            <field name="name">Analytic Defaults</field>
            <field name="res_model">account.analytic.default</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="search_view_id" ref="view_account_analytic_default_form_search"/>
            <field name="context">{"search_default_current":1}</field>
        </record>

        <act_window
            name="Entries"
            id="act_account_acount_move_line_open"
            res_model="account.move.line"
            src_model="account.account"
            context="{'search_default_account_id': [active_id], 'default_account_id': active_id}"
            />

        <menuitem
            action="action_analytic_default_list"
            id="menu_analytic_default_list"
            parent="account.menu_analytic_accounting"/>


        <act_window
            name="Analytic Rules"
            id="analytic_rule_action_partner"
            res_model="account.analytic.default"
            src_model="res.partner"
            context="{'search_default_partner_id': [active_id], 'default_partner_id': active_id}"
            groups="analytic.group_analytic_accounting"/>

        <act_window
            name="Analytic Rules"
            id="analytic_rule_action_user"
            res_model="account.analytic.default"
            src_model="res.users"
            context="{'search_default_user_id': [active_id], 'default_user_id': active_id}"
            groups="analytic.group_analytic_accounting"/>

        <act_window
            name="Analytic Rules"
            res_model="account.analytic.default"
            id="analytic_rule_action_product"
            src_model="product.product"
            context="{'search_default_product_id': [active_id], 'default_product_id': active_id}"
            groups="analytic.group_analytic_accounting"/>

    </data>
</openerp>
