<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <record id="view_order_form" model="ir.ui.view">
        <field name="name">sale.order.form</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_order_form" />
        <field name="arch" type="xml">
            <xpath
                expr="//field[@name='order_line']/list/field[@name='price_subtotal']"
                position="after"
            >
                <field name="warehouse_id" readonly="state not in ['draft', 'sent']" />
            </xpath>
        </field>
    </record>
    <record id="view_order_form_form" model="ir.ui.view">
        <field name="name">sale.order.form</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale_stock.view_order_form_inherit_sale_stock" />
        <field name="arch" type="xml">
            <xpath
                expr="//field[@name='order_line']/form//field[@name='route_id']"
                position="before"
            >
                <field name="warehouse_id" readonly="state not in ['draft', 'sent']" />
            </xpath>
            <xpath expr="//field[@name='order_line']" position="attributes">
                <attribute
                    name="context"
                >{'default_warehouse_id': warehouse_id}</attribute>
            </xpath>
        </field>
    </record>
</odoo>
