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

    <record id="fusion_view_purchase_order_wizard" model="ir.ui.view">
        <field name="name">fusion.so.po.wiz.form</field>
        <field name="model">fusion.so.po.wiz</field>
        <field name="arch" type="xml">
            <form string="Create Purchase Orders">
                <field name="fusion_so_id" invisible="1"/>

                <group>
                    <group string="Assign Vendor to Selected">
                        <field name="fusion_batch_vendor_id" options="{'no_create': True}" placeholder="Select vendor to assign..."/>
                    </group>
                    <group>
                        <p class="text-muted mt-4">
                            <b>Tip:</b> Check the boxes below to select products, then pick a vendor above to assign to selected only.
                            If nothing is selected, vendor applies to all.
                        </p>
                    </group>
                </group>

                <separator/>

                <field name="fusion_line_ids" nolabel="1">
                    <list editable="bottom" create="false">
                        <field name="selected" string="Select"/>
                        <field name="vendor_id" string="Vendor" placeholder="Select vendor..." widget="many2one" options="{'no_create': True, 'no_quick_create': True}"/>
                        <field name="product_id" string="Product" readonly="1" force_save="1"/>
                        <field name="description" string="Description" readonly="1" force_save="1" column_invisible="1"/>
                        <field name="product_uom_qty" string="Qty" readonly="1" force_save="1"/>
                        <field name="product_uom" string="UoM" readonly="1" force_save="1" groups="uom.group_uom" optional="hide"/>
                        <field name="price_unit" string="Unit Price" force_save="1"/>
                        <field name="price_subtotal" string="Subtotal" readonly="1" force_save="1"/>
                        <field name="fusion_so_line_id" column_invisible="1" force_save="1"/>
                    </list>
                </field>

                <footer>
                    <button name="fusion_create_po" string="Create Purchase Orders" type="object" class="btn-primary"/>
                    <button special="cancel" string="Cancel" class="btn-secondary"/>
                </footer>
            </form>
        </field>
    </record>

    <record id="fusion_purchase_order_wizard_action" model="ir.actions.act_window">
        <field name="name">Create Purchase Order</field>
        <field name="res_model">fusion.so.po.wiz</field>
        <field name="type">ir.actions.act_window</field>
        <field name="view_mode">form</field>
        <field name="target">new</field>
    </record>

    </data>
</odoo>
