<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2024 ACSONE SA/NV
     License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>

    <record model="ir.ui.view" id="stock_return_picking_form_view">
        <field name="model">stock.return.picking</field>
        <field name="inherit_id" ref="stock.view_stock_return_picking_form" />
        <field name="arch" type="xml">
            <xpath
                expr="//field[@name='product_return_moves']//tree//field[@name='rma_operation_id']"
                position="before"
            >
                <field
                    name="rma_reason_id"
                    attrs="{'column_invisible': [('parent.create_rma', '=', False)], 'required': [('is_rma_reason_required', '=', True), ('parent.create_rma', '=', True), ('quantity', '>', 0)]}"
                />
                <field name="is_rma_reason_required" invisible="1" />
                <field name="rma_operation_domain" invisible="1" />
            </xpath>
            <xpath
                expr="//field[@name='product_return_moves']//tree//field[@name='rma_operation_id']"
                position="attributes"
            >
                <attribute name="domain">rma_operation_domain</attribute>
            </xpath>
            <xpath
                expr="//group[@name='group_rma']//field[@name='rma_operation_id']"
                position="before"
            >
                <field
                    name="rma_reason_id"
                    attrs="{'invisible': [('create_rma', '=', False)]}"
                />
                <field name="rma_operation_domain" invisible="1" />
            </xpath>
            <xpath
                expr="//group[@name='group_rma']//field[@name='rma_operation_id']"
                position="attributes"
            >
                <attribute name="domain">rma_operation_domain</attribute>
            </xpath>

        </field>
    </record>



</odoo>
