<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data noupdate="1">
        <!-- After installation of the module, open the related menu -->
        <record id="action_client_purchase_menu" model="ir.actions.client">
            <field name="name">Open Purchase Menu</field>
            <field name="tag">reload</field>
            <field name="params" eval="{'menu_id': ref('base.menu_purchase_root')}"/>
        </record>
        <record id="base.open_menu" model="ir.actions.todo">
            <field name="action_id" ref="action_client_purchase_menu"/>
            <field name="state">open</field>
        </record>
    </data>
    <data>
        <record id="view_purchase_configuration" model="ir.ui.view">
            <field name="name">purchase settings</field>
            <field name="model">purchase.config.settings</field>
            <field name="arch" type="xml">
                <form string="Configure Purchases" class="oe_form_configuration" version="7.0">
                    <header>
                        <button string="Apply" type="object" name="execute" class="oe_highlight"/>
                        or
                        <button string="Cancel" type="object" name="cancel" class="oe_link"/>
                    </header>
                    <separator string="Invoicing Process"/>
                    <group>
                        <label for="id" string="Invoicing Settings"/>
                        <div>
                            <div>
                                <label for="default_invoice_method"/>
                                <field name="default_invoice_method" class="oe_inline"/>
                            </div>
                        </div>
                    </group>
                    <separator string="Purchase Order"/>
                    <group>
                        <label for="id" string="Supplier Features"/>
                        <div>
                            <div>
                                <field name="group_purchase_pricelist" class="oe_inline"/>
                                <label for="group_purchase_pricelist"/>
                            </div>
                            <div>
                                <field name="module_warning" class="oe_inline"/>
                                <label for="module_warning"/>
                            </div>
                        </div>
                    </group>
                    <group>
                        <label for="id" string="Purchase Order"/>
                        <div>
                            <div>
                                <field name="group_uom" class="oe_inline"/>
                                <label for="group_uom"/>
                            </div>
                            <div>
                                <field name="group_costing_method" class="oe_inline"/>
                                <label for="group_costing_method"/>
                            </div>
                            <div name="module_purchase_double_validation">
                                <field name="module_purchase_double_validation" class="oe_inline"/>
                                <label for="module_purchase_double_validation"/>
                            </div>
                            <div>
                                <field name="module_purchase_requisition" class="oe_inline"/>
                                <label for="module_purchase_requisition"/>
                            </div>
                            <div>
                                <field name="module_purchase_analytic_plans" on_change="onchange_purchase_analytic_plans(module_purchase_analytic_plans, context)" class="oe_inline"/>
                                <label for="module_purchase_analytic_plans"/>
                            </div>
                            <div>
                                <field name="group_analytic_account_for_purchases" class="oe_inline"/>
                                <label for="group_analytic_account_for_purchases"/>
                            </div>
                        </div>
                    </group>
                </form>
            </field>
        </record>

        <record id="action_purchase_configuration" model="ir.actions.act_window">
            <field name="name">Configure Purchases</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">purchase.config.settings</field>
            <field name="view_mode">form</field>
            <field name="target">inline</field>
        </record>

        <menuitem id="menu_purchase_config" name="Purchases" parent="base.menu_config"
            sequence="3" action="action_purchase_configuration"/>

        <record id="view_account_config" model="ir.ui.view">
            <field name="name">account settings</field>
            <field name="model">account.config.settings</field>
            <field name="inherit_id" ref="account.view_account_config_settings"/>
            <field name="priority" eval="18"/>
            <field name="arch" type="xml">
                <separator name="analytic_account" position="attributes">
                    <attribute name="invisible">0</attribute>
                </separator>
                <group name="analytic_account_purchase" position="attributes">
                    <attribute name="invisible">0</attribute>
                </group>
                <xpath expr="//group[@name='analytic_account_purchase']/div" position="inside">
                    <div>
                        <field name="group_analytic_account_for_purchases" class="oe_inline"/>
                        <label for="group_analytic_account_for_purchases"/>
                    </div>
                    <div>
                        <field name="module_purchase_analytic_plans" on_change="onchange_purchase_analytic_plans(module_purchase_analytic_plans, context)" class="oe_inline"/>
                        <label for="module_purchase_analytic_plans"/>
                    </div>
                </xpath>
            </field>
        </record>

    </data>
</openerp>
