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

    <record id="rental_return_wizard_form" model="ir.ui.view">
        <field name="name">rental.return.wizard.form</field>
        <field name="model">rental.return.wizard</field>
        <field name="arch" type="xml">
            <form string="Return &amp; Inspection">
                <group>
                    <group>
                        <field name="order_id"/>
                        <field name="partner_id"/>
                    </group>
                </group>

                <separator string="Items Being Returned"/>
                <field name="line_ids" nolabel="1" readonly="1">
                    <list>
                        <field name="product_id"/>
                        <field name="description"/>
                        <field name="qty_delivered"/>
                        <field name="qty_returned"/>
                        <field name="qty_to_return"/>
                    </list>
                </field>

                <separator string="Inspection"/>
                <group>
                    <group>
                        <field name="inspection_condition" widget="radio"/>
                    </group>
                    <group>
                        <field name="inspection_notes"
                               placeholder="Describe any issues, damage, missing parts..."
                               invisible="inspection_condition == 'good'"/>
                    </group>
                </group>

                <group string="Inspection Photos (Required)">
                    <field name="inspection_photo_ids"
                           widget="inspection_photos"
                           nolabel="1"
                           class="o_inspection_photos"
                           options="{'accepted_file_extensions': 'image/*'}"/>
                    <div class="text-muted small">
                        Click the attach button to add multiple photos.
                        Click any photo thumbnail to preview full size.
                    </div>
                </group>

                <div class="alert alert-info" role="alert"
                     invisible="inspection_condition != 'good'">
                    Items are in good condition. The security deposit refund process
                    will be initiated automatically after confirmation.
                </div>
                <div class="alert alert-warning" role="alert"
                     invisible="inspection_condition not in ('fair', 'damaged')">
                    Items have been flagged. A staff activity will be created
                    for review and the customer will be notified.
                    Please provide detailed notes and photos.
                </div>

                <footer>
                    <button name="action_confirm"
                            type="object"
                            class="btn-primary"
                            string="Confirm Return &amp; Inspection"/>
                    <button string="Cancel" class="btn-secondary" special="cancel"/>
                </footer>
            </form>
        </field>
    </record>

</odoo>
