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

    <!-- ========== ПРОДАЖА 1: ООО "Технологии Будущего" ========== -->
    <record id="demo_sale_order_001" model="sale.order">
        <field name="partner_id" ref="demo_partner_buyer"/>
        <field name="partner_invoice_id" ref="demo_partner_buyer"/>
        <field name="partner_shipping_id" ref="demo_partner_buyer"/>
        <field name="company_id" ref="base.main_company"/>
        <field name="mt_contract_id" ref="demo_contract_customer_001"/>
        <field name="date_order">2026-01-10 09:00:00</field>
        <field name="user_id" ref="demo_user_manager"/>
        <field name="state">sale</field>
    </record>
    <record id="demo_sale_line_001_1" model="sale.order.line">
        <field name="order_id" ref="demo_sale_order_001"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_software_tmpl'))]"/>
        <field name="product_uom_qty">1.0</field>
        <field name="price_unit">185000.0</field>
    </record>
    <record id="demo_sale_line_001_2" model="sale.order.line">
        <field name="order_id" ref="demo_sale_order_001"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_implementation_tmpl'))]"/>
        <field name="product_uom_qty">1.0</field>
        <field name="price_unit">120000.0</field>
    </record>
    <record id="demo_sale_line_001_3" model="sale.order.line">
        <field name="order_id" ref="demo_sale_order_001"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_training_tmpl'))]"/>
        <field name="product_uom_qty">2.0</field>
        <field name="price_unit">45000.0</field>
    </record>

    <!-- ========== ПРОДАЖА 2: ООО "Ритейл Плюс" ========== -->
    <record id="demo_sale_order_1" model="sale.order">
        <field name="partner_id" ref="demo_partner_invoice_1"/>
        <field name="partner_invoice_id" ref="demo_partner_invoice_1"/>
        <field name="partner_shipping_id" ref="demo_partner_invoice_1"/>
        <field name="company_id" ref="base.main_company"/>
        <field name="mt_contract_id" ref="demo_contract_customer_002"/>
        <field name="date_order">2026-01-20 10:00:00</field>
        <field name="user_id" ref="demo_user_manager"/>
        <field name="state">sale</field>
    </record>
    <record id="demo_sale_line_1_1" model="sale.order.line">
        <field name="order_id" ref="demo_sale_order_1"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_license_tmpl'))]"/>
        <field name="product_uom_qty">10.0</field>
        <field name="price_unit">24000.0</field>
    </record>
    <record id="demo_sale_line_1_2" model="sale.order.line">
        <field name="order_id" ref="demo_sale_order_1"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_support_tmpl'))]"/>
        <field name="product_uom_qty">3.0</field>
        <field name="price_unit">35000.0</field>
    </record>

    <!-- ========== ПРОДАЖА 3: ООО "МегаТорг" ========== -->
    <record id="demo_sale_order_2" model="sale.order">
        <field name="partner_id" ref="demo_partner_invoice_2"/>
        <field name="partner_invoice_id" ref="demo_partner_invoice_2"/>
        <field name="partner_shipping_id" ref="demo_partner_invoice_2"/>
        <field name="company_id" ref="base.main_company"/>
        <field name="mt_contract_id" ref="demo_contract_customer_003"/>
        <field name="date_order">2026-02-05 11:00:00</field>
        <field name="user_id" ref="demo_user_manager"/>
        <field name="state">sale</field>
    </record>
    <record id="demo_sale_line_2_1" model="sale.order.line">
        <field name="order_id" ref="demo_sale_order_2"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_tovar_tmpl'))]"/>
        <field name="product_uom_qty">2.0</field>
        <field name="price_unit">95000.0</field>
    </record>
    <record id="demo_sale_line_2_2" model="sale.order.line">
        <field name="order_id" ref="demo_sale_order_2"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_implementation_tmpl'))]"/>
        <field name="product_uom_qty">1.0</field>
        <field name="price_unit">120000.0</field>
    </record>

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

</data>
</odoo>
