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

    <!-- Инвойсы создаются в draft. mt_contract_id не ставим — иначе constrains проверяет receivable счёт -->

    <!-- ========== ИСХОДЯЩИЙ СЧЁТ 1: ООО "Технологии Будущего" ========== -->
    <record id="demo_invoice_001" model="account.move">
        <field name="move_type">out_invoice</field>
        <field name="partner_id" ref="demo_partner_buyer"/>
        <field name="company_id" ref="base.main_company"/>
        <field name="invoice_date">2026-01-25</field>
        <field name="invoice_date_due">2026-02-25</field>
        <field name="sf_number">1</field>
        <field name="osnovanie">Договор № 001/2026 от 10.01.2026</field>
        <field name="gruzootpr" ref="base.main_partner"/>
        <field name="gruzopol" ref="demo_partner_buyer"/>
        <field name="kladov" ref="demo_employee_ivanov"/>
        <field name="only_service" eval="True"/>
    </record>
    <record id="demo_invoice_001_line_1" model="account.move.line">
        <field name="move_id" ref="demo_invoice_001"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_software_tmpl'))]"/>
        <field name="quantity">1.0</field>
        <field name="price_unit">185000.0</field>
        <field name="name">Система управления складом WMS Pro</field>
    </record>
    <record id="demo_invoice_001_line_2" model="account.move.line">
        <field name="move_id" ref="demo_invoice_001"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_implementation_tmpl'))]"/>
        <field name="quantity">1.0</field>
        <field name="price_unit">120000.0</field>
        <field name="name">Услуги внедрения и настройки системы</field>
    </record>
    <record id="demo_invoice_001_line_3" model="account.move.line">
        <field name="move_id" ref="demo_invoice_001"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_training_tmpl'))]"/>
        <field name="quantity">2.0</field>
        <field name="price_unit">45000.0</field>
        <field name="name">Обучение пользователей (группа до 10 чел.)</field>
    </record>

    <!-- ========== ИСХОДЯЩИЙ СЧЁТ 2: ООО "Ритейл Плюс" ========== -->
    <record id="demo_invoice_002" model="account.move">
        <field name="move_type">out_invoice</field>
        <field name="partner_id" ref="demo_partner_invoice_1"/>
        <field name="company_id" ref="base.main_company"/>
        <field name="invoice_date">2026-02-01</field>
        <field name="invoice_date_due">2026-03-01</field>
        <field name="sf_number">2</field>
        <field name="osnovanie">Договор № 002/2026 от 20.01.2026</field>
        <field name="gruzootpr" ref="base.main_partner"/>
        <field name="gruzopol" ref="demo_partner_invoice_1"/>
        <field name="kladov" ref="demo_employee_ivanov"/>
        <field name="only_service" eval="True"/>
    </record>
    <record id="demo_invoice_002_line_1" model="account.move.line">
        <field name="move_id" ref="demo_invoice_002"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_license_tmpl'))]"/>
        <field name="quantity">10.0</field>
        <field name="price_unit">24000.0</field>
        <field name="name">Лицензия пользователя WMS Pro (1 год)</field>
    </record>
    <record id="demo_invoice_002_line_2" model="account.move.line">
        <field name="move_id" ref="demo_invoice_002"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_support_tmpl'))]"/>
        <field name="quantity">3.0</field>
        <field name="price_unit">35000.0</field>
        <field name="name">Техническая поддержка и сопровождение (мес.)</field>
    </record>

    <!-- ========== ИСХОДЯЩИЙ СЧЁТ 3: ООО "МегаТорг" ========== -->
    <record id="demo_invoice_003" model="account.move">
        <field name="move_type">out_invoice</field>
        <field name="partner_id" ref="demo_partner_invoice_2"/>
        <field name="company_id" ref="base.main_company"/>
        <field name="invoice_date">2026-02-10</field>
        <field name="invoice_date_due">2026-03-10</field>
        <field name="sf_number">3</field>
        <field name="osnovanie">Договор № 003/2026 от 05.02.2026</field>
        <field name="gruzootpr" ref="base.main_partner"/>
        <field name="gruzopol" ref="demo_partner_invoice_2"/>
        <field name="kladov" ref="demo_employee_ivanov"/>
        <field name="only_service" eval="True"/>
    </record>
    <record id="demo_invoice_003_line_1" model="account.move.line">
        <field name="move_id" ref="demo_invoice_003"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_tovar_tmpl'))]"/>
        <field name="quantity">2.0</field>
        <field name="price_unit">95000.0</field>
        <field name="name">Комплект оборудования для автоматизации</field>
    </record>
    <record id="demo_invoice_003_line_2" model="account.move.line">
        <field name="move_id" ref="demo_invoice_003"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_implementation_tmpl'))]"/>
        <field name="quantity">1.0</field>
        <field name="price_unit">120000.0</field>
        <field name="name">Услуги внедрения и настройки системы</field>
    </record>

    <!-- ========== ВХОДЯЩИЙ СЧЁТ 1: ООО "СтройМатериалы Групп" ========== -->
    <record id="demo_bill_001" model="account.move">
        <field name="move_type">in_invoice</field>
        <field name="partner_id" ref="demo_partner_supplier"/>
        <field name="company_id" ref="base.main_company"/>
        <field name="invoice_date">2026-01-18</field>
        <field name="invoice_date_due">2026-02-18</field>
    </record>
    <record id="demo_bill_001_line_1" model="account.move.line">
        <field name="move_id" ref="demo_bill_001"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_server_tmpl'))]"/>
        <field name="quantity">2.0</field>
        <field name="price_unit">240000.0</field>
        <field name="name">Сервер Dell PowerEdge R740</field>
    </record>
    <record id="demo_bill_001_line_2" model="account.move.line">
        <field name="move_id" ref="demo_bill_001"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_tovar_tmpl'))]"/>
        <field name="quantity">5.0</field>
        <field name="price_unit">65000.0</field>
        <field name="name">Комплект оборудования для автоматизации</field>
    </record>

    <!-- ========== ВХОДЯЩИЙ СЧЁТ 2: ООО "ПромКомплект" ========== -->
    <record id="demo_bill_002" model="account.move">
        <field name="move_type">in_invoice</field>
        <field name="partner_id" ref="demo_partner_vendor_1"/>
        <field name="company_id" ref="base.main_company"/>
        <field name="invoice_date">2026-02-12</field>
        <field name="invoice_date_due">2026-03-12</field>
    </record>
    <record id="demo_bill_002_line_1" model="account.move.line">
        <field name="move_id" ref="demo_bill_002"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_tovar_tmpl'))]"/>
        <field name="quantity">10.0</field>
        <field name="price_unit">65000.0</field>
        <field name="name">Комплект оборудования для автоматизации</field>
    </record>

    <!-- ========== УПД ИНВОЙС ========== -->
    <record id="demo_invoice_doc_001" model="account.move">
        <field name="move_type">out_invoice</field>
        <field name="partner_id" ref="demo_partner_buyer"/>
        <field name="company_id" ref="base.main_company"/>
        <field name="invoice_date">2026-03-01</field>
        <field name="invoice_date_due">2026-04-01</field>
        <field name="sf_number">4</field>
        <field name="osnovanie">Договор № 001/2026 от 10.01.2026</field>
        <field name="gruzopol" ref="demo_partner_buyer"/>
        <field name="gruzootpr" ref="base.main_partner"/>
        <field name="kladov" ref="demo_employee_ivanov"/>
        <field name="only_service" eval="True"/>
    </record>
    <record id="demo_invoice_doc_line_001" model="account.move.line">
        <field name="move_id" ref="demo_invoice_doc_001"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_tovar_tmpl'))]"/>
        <field name="quantity">3.0</field>
        <field name="price_unit">95000.0</field>
        <field name="name">Комплект оборудования для автоматизации</field>
    </record>

    <!-- ========== АЛИАСЫ ДЛЯ СОВМЕСТИМОСТИ ========== -->
    <record id="demo_account_move_invoice_1" model="account.move">
        <field name="move_type">out_invoice</field>
        <field name="partner_id" ref="demo_partner_invoice_1"/>
        <field name="company_id" ref="base.main_company"/>
        <field name="invoice_date">2026-02-15</field>
        <field name="only_service" eval="True"/>
    </record>
    <record id="demo_account_move_invoice_1_line_1" model="account.move.line">
        <field name="move_id" ref="demo_account_move_invoice_1"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_support_tmpl'))]"/>
        <field name="quantity">1.0</field>
        <field name="price_unit">35000.0</field>
        <field name="name">Техническая поддержка и сопровождение (мес.)</field>
    </record>

    <record id="demo_account_move_invoice_2" model="account.move">
        <field name="move_type">out_invoice</field>
        <field name="partner_id" ref="demo_partner_invoice_2"/>
        <field name="company_id" ref="base.main_company"/>
        <field name="invoice_date">2026-02-20</field>
        <field name="only_service" eval="True"/>
    </record>
    <record id="demo_account_move_invoice_2_line_1" model="account.move.line">
        <field name="move_id" ref="demo_account_move_invoice_2"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_license_tmpl'))]"/>
        <field name="quantity">5.0</field>
        <field name="price_unit">24000.0</field>
        <field name="name">Лицензия пользователя WMS Pro (1 год)</field>
    </record>

    <record id="demo_account_move_bill_1" model="account.move">
        <field name="move_type">in_invoice</field>
        <field name="partner_id" ref="demo_partner_vendor_1"/>
        <field name="company_id" ref="base.main_company"/>
        <field name="invoice_date">2026-02-25</field>
    </record>
    <record id="demo_account_move_bill_1_line_1" model="account.move.line">
        <field name="move_id" ref="demo_account_move_bill_1"/>
        <field name="product_id" model="product.product" search="[('product_tmpl_id', '=', ref('demo_product_tovar_tmpl'))]"/>
        <field name="quantity">3.0</field>
        <field name="price_unit">65000.0</field>
        <field name="name">Комплект оборудования для автоматизации</field>
    </record>

</data>
</odoo>
