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

	<!-- Main Wizard Form -->
	<record id="view_purchase_order_wizard" model="ir.ui.view">
		<field name="name">purchase.order.wizard.form</field>
		<field name="model">purchaseorder.wiz</field>
		<field name="arch" type="xml">
			<form string="Create Purchase Orders">
				<field name="sale_order_id" invisible="1"/>
				
				<!-- Batch Assign Vendor -->
				<group>
					<group string="Assign Vendor to Selected">
						<field name="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/>
				
				<!-- Products List -->
				<field name="product_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="so_line_id" column_invisible="1" force_save="1"/>
					</list>
				</field>
				
				<footer>
					<button name="create_po" string="Create Purchase Orders" type="object" class="btn-primary"/>
					<button special="cancel" string="Cancel" class="btn-secondary"/>
				</footer>
			</form>
		</field>
	</record>

	<!-- Main Action -->
	<record id="purchase_order_wizard_action" model="ir.actions.act_window">
		<field name="name">Create Purchase Order</field>
		<field name="res_model">purchaseorder.wiz</field>
		<field name="type">ir.actions.act_window</field>
		<field name="view_mode">form</field>
		<field name="target">new</field>
	</record>

	</data>
</odoo>
