<odoo>
    <record id="view_po_downpayment_wizard" model="ir.ui.view">
        <field name="name">Purchase order down payment</field>
        <field name="model">purchase.order.down.payment.wizard</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form>
                <p class="oe_grey">
                    Payment will be created in draft so that you can review
                    them before validation.
                </p>
                <group>
                    <field name="order_id" invisible="1" />
                    <field
                        name="advance_payment_method"
                        class="oe_inline"
                        widget="radio"
                    />
                </group>
                <group
                    name="down_payment_specification"
                    attrs="{'invisible': [('advance_payment_method', 'not in', ('fixed', 'percentage'))]}"
                >
                    <label for="amount" />
                    <div id="payment_method_details">
                        <field
                            name="fixed_amount"
                            attrs="{'required': [('advance_payment_method', '=', 'fixed')],
                                'invisible': [('advance_payment_method', '!=', 'fixed')]}"
                            class="oe_inline"
                        />
                        <field
                            name="amount"
                            attrs="{'required': [('advance_payment_method', '=', 'percentage')],
                                'invisible': [('advance_payment_method', '!=', 'percentage')]}"
                            class="oe_inline"
                        />
                        <span
                            attrs="{'invisible': [('advance_payment_method', '!=', 'percentage')]}"
                            class="oe_inline"
                        >%</span>
                    </div>
                </group>
                <footer>
                    <button
                        name="create_payment"
                        string="Create and view payment"
                        type="object"
                        class="btn-primary"
                        context="{'view_payment': 1}"
                    />
                    <button
                        name="create_payment"
                        string="Create payment"
                        type="object"
                    />

                    <button special="cancel" string="Cancel" class="btn-default" />
                </footer>
            </form>
        </field>
    </record>
    <record id="action_view_po_downpayment_wizard" model="ir.actions.act_window">
        <field name="name">Payment</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">purchase.order.down.payment.wizard</field>
        <field name="view_mode">form</field>
        <field name="target">new</field>
    </record>
</odoo>
