<?xml version="1.0"?>
<openerp>
<data>

    <record model="ir.ui.view" id="purchase_order_line_form_inherit">
        <field name="name">purchase.order.line.form.inherit</field>
        <field name="model">purchase.order.line</field>
        <field name="inherit_id" ref="purchase.purchase_order_line_form"/>
        <field name="arch" type="xml">
            <field name="account_analytic_id" position="replace">
                <field name="analytics_id"  context="{'journal_id':parent.journal_id, 'model': 'purchase_order'}" domain="[('plan_id','&lt;&gt;',False)]"/>
            </field>
        </field>
    </record>

    <record model="ir.ui.view" id="purchase_order_form_analytic_inherit">
        <field name="name">purchase.order.form.analytic.inherit</field>
        <field name="model">purchase.order</field>
        <field name="inherit_id" ref="purchase.purchase_order_form"/>
        <field name="arch" type="xml">
            <field name="account_analytic_id" position="replace">
                <field name="analytics_id" context="{'journal_id':parent.journal_id}" domain="[('plan_id','&lt;&gt;',False)]"/>
            </field>
        </field>
    </record>

    <!-- inherited view to make the purchase order lines list in the form non-editable
             for the members of some usability groups -->
    <record id="view_purchase_order_form_editable_list" model="ir.ui.view">
        <field name="name">purchase.order.form.editable.list</field>
        <field name="model">purchase.order</field>
        <field name="inherit_id" ref="purchase.purchase_order_form"/>
        <field name="groups_id" eval="[(6, 0, [ref('product.group_uom'), ref('purchase.group_analytic_accounting')])]"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='order_line']/tree" position="attributes">
                <attribute name="editable"/>
            </xpath>
        </field>
    </record>



    <!-- Replace analytic_id with analytics_id in account.invoice.line -->



    <record model="ir.ui.view" id="invoice_supplier_form_inherit">
        <field name="name">account.invoice.supplier.form.inherit</field>
        <field name="model">account.invoice</field>
        <field name="inherit_id" ref="account.invoice_supplier_form"/>
        <field name="priority">2</field>
        <field name="arch" type="xml">
            <field name="account_analytic_id" position="replace">
                <field name="analytics_id" domain="[('plan_id','&lt;&gt;',False)]" context="{'journal_id':parent.journal_id}" groups="analytic.group_analytic_accounting"/>
            </field>
        </field>
    </record>
</data>
</openerp>
