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

    <!-- ========== ЗАКУПКА 1: ООО "СтройМатериалы Групп" ========== -->
    <record id="demo_purchase_order_001" model="purchase.order">
        <field name="partner_id" ref="demo_partner_supplier"/>
        <field name="company_id" ref="base.main_company"/>
        <field name="date_order">2026-01-05 09:00:00</field>
        <field name="user_id" ref="demo_user_purchaser"/>
        <field name="state">purchase</field>
    </record>
    <record id="demo_purchase_line_001_1" model="purchase.order.line">
        <field name="order_id" ref="demo_purchase_order_001"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_server_tmpl'))]"/>
        <field name="product_qty">2.0</field>
        <field name="price_unit">240000.0</field>
        <field name="date_planned">2026-01-20 09:00:00</field>
    </record>
    <record id="demo_purchase_line_001_2" model="purchase.order.line">
        <field name="order_id" ref="demo_purchase_order_001"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_tovar_tmpl'))]"/>
        <field name="product_qty">5.0</field>
        <field name="price_unit">65000.0</field>
        <field name="date_planned">2026-01-20 09:00:00</field>
    </record>

    <!-- ========== ЗАКУПКА 2: ООО "Снабжение Плюс" ========== -->
    <record id="demo_purchase_order_002" model="purchase.order">
        <field name="partner_id" ref="demo_attorney_partner_supplier"/>
        <field name="company_id" ref="base.main_company"/>
        <field name="date_order">2026-01-15 10:00:00</field>
        <field name="user_id" ref="demo_user_purchaser"/>
        <field name="state">purchase</field>
    </record>
    <record id="demo_purchase_line_002_1" model="purchase.order.line">
        <field name="order_id" ref="demo_purchase_order_002"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_software_tmpl'))]"/>
        <field name="product_qty">3.0</field>
        <field name="price_unit">95000.0</field>
        <field name="date_planned">2026-01-25 09:00:00</field>
    </record>

    <!-- ========== ЗАКУПКА 3: ООО "ПромКомплект" ========== -->
    <record id="demo_purchase_order_003" model="purchase.order">
        <field name="partner_id" ref="demo_partner_vendor_1"/>
        <field name="company_id" ref="base.main_company"/>
        <field name="date_order">2026-02-01 09:00:00</field>
        <field name="user_id" ref="demo_user_purchaser"/>
        <field name="state">purchase</field>
    </record>
    <record id="demo_purchase_line_003_1" model="purchase.order.line">
        <field name="order_id" ref="demo_purchase_order_003"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_tovar_tmpl'))]"/>
        <field name="product_qty">10.0</field>
        <field name="price_unit">65000.0</field>
        <field name="date_planned">2026-02-15 09:00:00</field>
    </record>

    <!-- Создаём инвойсы через стандартный механизм — появится смарт-кнопка -->
    <function model="purchase.order" name="action_create_invoice">
        <value model="purchase.order" eval="[ref('demo_purchase_order_001'), ref('demo_purchase_order_002'), ref('demo_purchase_order_003')]"/>
    </function>

</data>
</odoo>
