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

    <!-- Send Fax Wizard Form -->
    <record id="view_send_fax_wizard_form" model="ir.ui.view">
        <field name="name">fusion_faxes.send.fax.wizard.form</field>
        <field name="model">fusion_faxes.send.fax.wizard</field>
        <field name="arch" type="xml">
            <form string="Send Fax">
                <group>
                    <group>
                        <field name="partner_id"/>
                        <field name="fax_number"/>
                    </group>
                    <group>
                        <field name="generate_pdf"/>
                        <field name="sale_order_id" readonly="1"
                               invisible="not sale_order_id"/>
                        <field name="account_move_id" readonly="1"
                               invisible="not account_move_id"/>
                    </group>
                </group>
                <group>
                    <field name="cover_page_text"
                           placeholder="Optional cover page message..."/>
                </group>

                <!-- Ordered document list with drag handle and file upload -->
                <separator string="Documents (drag to reorder)"/>
                <field name="document_line_ids" nolabel="1">
                    <list editable="bottom">
                        <field name="sequence" widget="handle"/>
                        <field name="file_upload" filename="file_name"/>
                        <field name="file_name"/>
                        <field name="attachment_id" column_invisible="1"/>
                        <widget name="preview_button"/>
                    </list>
                </field>

                <footer>
                    <button name="action_send" string="Send Fax"
                            type="object" class="btn-primary"
                            icon="fa-fax"/>
                    <button string="Cancel" class="btn-secondary" special="cancel"/>
                </footer>
            </form>
        </field>
    </record>

    <!-- Wizard action (for standalone use from menu) -->
    <record id="action_send_fax_wizard" model="ir.actions.act_window">
        <field name="name">Send Fax</field>
        <field name="res_model">fusion_faxes.send.fax.wizard</field>
        <field name="view_mode">form</field>
        <field name="target">new</field>
    </record>

    <menuitem id="menu_send_fax"
              name="Send Fax"
              parent="menu_fusion_faxes_root"
              action="action_send_fax_wizard"
              sequence="5"/>

</odoo>
