<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <record id="view_move_line_tree" model="ir.ui.view">
        <field name="name">stock.move.line.tree</field>
        <field name="model">stock.move.line</field>
        <field name="inherit_id" ref="stock.view_move_line_tree" />
        <field name="arch" type="xml">
            <field name="lot_id" position="after">
                <field name="lot_info" />
            </field>
        </field>
    </record>

    <record id="view_move_line_tree_detailed" model="ir.ui.view">
        <field name="name">stock.move.line.tree.detailed</field>
        <field name="model">stock.move.line</field>
        <field name="inherit_id" ref="stock.view_move_line_tree_detailed" />
        <field name="arch" type="xml">
            <field name="lot_id" position="after">
                <field name="lot_info" />
            </field>
        </field>
    </record>

    <record id="view_move_line_form" model="ir.ui.view">
        <field name="name">stock.move.line.form</field>
        <field name="model">stock.move.line</field>
        <field name="inherit_id" ref="stock.view_move_line_form" />
        <field name="arch" type="xml">
            <field name="lot_id" position="after">
                <field name="lot_info" />
            </field>
        </field>
    </record>

    <record id="view_stock_move_line_operation_tree" model="ir.ui.view">
        <field name="name">stock.move.line.operations.tree</field>
        <field name="model">stock.move.line</field>
        <field name="inherit_id" ref="stock.view_stock_move_line_operation_tree" />
        <field name="arch" type="xml">
            <xpath expr="//field[@name='lot_name']" position="after">
                <field name="lot_info_usage" invisible="1" />
                <field
                    name="lot_info"
                    attrs="{
                       'readonly': [('lot_info_usage', '=', 'no')],
                       'required': [('lot_info_usage', '=', 'required')],
                       }"
                />
            </xpath>
        </field>
    </record>

    <record id="view_stock_move_line_detailed_operation_tree" model="ir.ui.view">
        <field name="name">stock.move.line.operations.tree</field>
        <field name="model">stock.move.line</field>
        <field
            name="inherit_id"
            ref="stock.view_stock_move_line_detailed_operation_tree"
        />
        <field name="arch" type="xml">
            <xpath expr="//field[@name='lot_name']" position="after">
                <field name="lot_info_usage" invisible="1" />
                <field
                    name="lot_info"
                    attrs="{
                       'readonly': [('lot_info_usage', '=', 'no')],
                       'required': [('lot_info_usage', '=', 'required')],
                       }"
                />
            </xpath>
        </field>
    </record>
</odoo>
