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

    <record model="ir.ui.view" id="purchase_order_line_form">
        <field name="name">purchase.order.line.form</field>
        <field name="model">purchase.order.line</field>
        <field name="inherit_id" ref="purchase.purchase_order_line_form2" />
        <field name="arch" type="xml">
            <field name="company_id" position="after">
                <field name="visible_sequence" />
            </field>
        </field>
    </record>

    <record id="purchase_order_form" model="ir.ui.view">
        <field name="name">purchase.order.form</field>
        <field name="model">purchase.order</field>
        <field name="inherit_id" ref="purchase.purchase_order_form" />
        <field name="priority">2</field>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='order_line']" position="before">
                <field name="max_line_sequence" invisible="1" />
            </xpath>
            <xpath expr="//field[@name='order_line']" position="attributes">
                <attribute name="context">{'default_sequence':
                    max_line_sequence, 'default_state': 'draft'}</attribute>
            </xpath>
            <xpath
                expr="//field[@name='order_line']/tree/field[@name='product_id']"
                position="before"
            >
                <field name="visible_sequence" />
            </xpath>
        </field>
    </record>

</odoo>
